Subscribe For Free Updates!

We'll not spam mate! We promise.

Sunday 24 November 2013

Howto configure NTP client in Mikrotik / Ubuntu for Asia/Karachi



For Personnel Reference
Recently I received email from a friend who was annoyed by the RB date/time resetting upon every reboot. He had USERMAN with above 500 users, so it was a big problem from the accounting perspective. He thought RB also have the battery to save the time/data :D , He asked me how he can replace the battery :p
Routerboards do not have an internal clock to keep time between reboots. You have to configure NTP client to obtain ip from Time Server. Following are the scripts to update your NTP client and set time zone to +5 (for Karachi/Pakistan). Make sure you have enabled internet access on the router before configuring NTP.After configuring NTP, you wont have to manually configure the time CLOCK. This is very crucial for mikrotik to obtain correct time specially for LOG purposes and if you are doing user accounting by using Radius Server like USERMAN on it. For example if the RB reboots and the date/time resets to previous dates, then it can create lot of problems for user accounting. Thats why NTP client ensures that you always get the proper date/time upon every reboot or in routine. Use the following script to setup NTP client.
1
2
3
4
5
6
7
/system clock
set time-zone-name=manual
/system clock manual
set dst-delta=+00:00 dst-end="jan/01/1970 00:00:00" dst-start="jan/01/1970 00:00:00" time-zone=+05:00
 
/system ntp client
set enabled=yes mode=unicast primary-ntp=82.165.36.179 secondary-ntp=0.0.0.0
It is recommended that you reboot the router after time change. After 7-8 seconds you will get the correct date/time …
For other countries, change the timezone according to there local timings.

Howto configure NTP in Ubuntu

First install NTP service on Ubuntu sing below command,
apt-get install ntp
Now edit ntp.conf file to add NTP server.
nano /etc/ntp.conf
Add this parameter anywhere in this file.
server 82.165.36.179
Save & exit.
Now copy PK Time zone to /etc
cp /usr/share/zoneinfo/Asia/Karachi /etc/localtime
Use the below command to update the time.
ntpdate -u   82.165.36.179
Now type date to verify time.
Regard’s
naveed ahmad

Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT → , ,
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment

 
".