I have a problem with date and time on all my cards, essentially every time a card is restarted for whatever reason, reset the date and time, doing what I can see things from the logs has happened but I can not tell when.
I am on the log the date and time default is: Jan/02/2970 00:00.
How can I fix it? in essence, to me you need not reset the date when the right one mantegga and reboot.
This is a FAQ. RouterBOARDs don’t have CMOS batteries so they don’t keep time across reboots. Look up NTP on the wiki, and use it to sync time across the network.
The usual answer seems to be setting up NTP so that the router resets it clock when it reboots.
There are a couple good wiki pages on it. If you already have a local NTP server point it to that. Otherwise there are scripts available to have it use pool.ntp.org and periodically update which server it’s querying.
I ended up with something like this after simplifying one of the examples:
[admin@MikroTik] > /system scheduler
[admin@MikroTik] /system scheduler> print
Flags: X - disabled
# NAME START-DATE START-TIME INTERVAL ON-EVENT RUN-COUNT
0 ;;; Check and set NTP servers
Che... jan/01/1970 16:00:00 12h setntppool 8
[admin@MikroTik] /system scheduler> .. script
[admin@MikroTik] /system script> print[admin@MikroTik] /system script> print
Flags: I - invalid
0 name="setntppool" owner="admin" policy=read,write,test
last-started=jul/16/2011 16:00:00 run-count=9
source=
# Check and set NTP servers - "setntppool"
# Resolve the two ntp pool hostnames
:local ntpipa [:resolve "0.us.pool.ntp.org"];
:local ntpipb [:resolve "1.us.pool.ntp.org"];
# Get the current settings
:local ntpcura [/system ntp client get primary-ntp];
:local ntpcurb [/system ntp client get secondary-ntp];
# Debug output
:put ("Old: " . $ntpcura . " New: " . $ntpipa);
:put ("Old: " . $ntpcurb . " New: " . $ntpipb);
# Change primary or secondary if required and log it.
:if (($ntpipa != $ntpcura) || ($ntpipb != $ntpcurb)) do={
:put "Making and logging NTP pool server change.";
/system ntp client set primary-ntp="$ntpipa" secondary-ntp="$ntpipb";
:log info ("NTP servers changed: Primary was: $ntpcura is: $ntpipa Secondary was: $ntpcurb is: $ntpipb");
}
You may need to change the pool server names to match your locale.