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 😀 , 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.
/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 # For Mikrotik 5.x syntax /system ntp client set enabled=yes mode=unicast primary-ntp=18.104.22.168 secondary-ntp=0.0.0.0 # For Mikrotik 6.x #/system ntp client #set enabled=yes primary-ntp=22.214.171.124 secondary-ntp=0.0.0.0
It is recommended that you reboot the router after time change. After few 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.
Add this parameter anywhere in this file.
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 126.96.36.199
to verify time.