What's new

ntpMerlin ntpMerlin - NTP Daemon for AsusWRT Merlin

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

@Jack Yaz I tried fishing for the logs but they seem to be encrypted in some sort of odd file format, logs form the device itself I can send it to you if you still are interested.
 
@Jack Yaz or another kind soul :)

Newbie question .. tried searching but having no luck so far ...

How do I "reset" (or wipe/delete) the stats database/collection and start again, as I've now settled on some NTP servers I'm happy with?
 
Last edited:
Question, trying to get stats to generate. The script seems to be working but I'm seeing no stats in the gui. Do I need scribe? Option 1, generate updated ntpmerlin graphs now, gives an error:
Code:
/jffs/scripts/ntpmerlin: line 1177: ntpq: not found
In the gui, <Enable local NTP server> reverts to NO, when I set it to yes when installing unbound_manager, no idea if that's related.
 
Question, trying to get stats to generate. The script seems to be working but I'm seeing no stats in the gui. Do I need scribe? Option 1, generate updated ntpmerlin graphs now, gives an error:
Code:
/jffs/scripts/ntpmerlin: line 1177: ntpq: not found
In the gui, <Enable local NTP server> reverts to NO, when I set it to yes when installing unbound_manager, no idea if that's related.
Not sure how scribe could help.
My ntpq is in /opt/sbin
My $PATH contains /opt/sbin
If you cd to /opt/sbin, you will be in the Entware sbin directory. The ntpMerlin (Entware actually) ntpd is in there as well.
 
Not sure how scribe could help.
My ntpq is in /opt/sbin
My $PATH contains /opt/sbin
If you cd to /opt/sbin, you will be in the Entware sbin directory. The ntpMerlin (Entware actually) ntpd is in there as well.
Thanks for that, it wasn't in there so I reinstalled ntpmerlin and have stats! Updating unbound_manager also updated without complaint about the <Enable local NTP server> being set to NO. Everything around here just keeps getting better.
 
If I'm understanding well, option 2 redirects all NTP requests on my network to my routers NTP Server, correct?
So it means if someone tries to NTP to time.google.com, it will redirect the traffic to router ip and get the time from my own routers server?

If that's correct, how can I check if traffic is being redirected ok?

Thank you!
 
If I'm understanding well, option 2 redirects all NTP requests on my network to my routers NTP Server, correct?
So it means if someone tries to NTP to time.google.com, it will redirect the traffic to router ip and get the time from my own routers server?

If that's correct, how can I check if traffic is being redirected ok?

Thank you!
tcpdump on the router should show if ntp traffic is hitting it
 
v2.3.0 is now available

Changelog:
Code:
Use csv files for ChartJS data - reduces generation time of stats
General improvements to WebUI page
Automatically purge data older than 30 days to prevent database file size growing too large
 
Last edited:
v2.3.1 is now available
Changelog:
Code:
Switch to single tar archive for shared-jy resources

With this update, if you are running my other scripts (connmon, ntpmerlin, spdmerlin, uiDivStats, modmon), you MUST update these as well. Ignore any error messages during updates after the first script (it will mention too many levels of symbolic links), and let the update complete.

Once you have updated all of the scripts, run
Code:
rm -rf /www/user/shared-jy && rm -rf /jffs/addons/shared-jy
then open any of the scripts mentioned above and run 1 further update.

This will hopefully be the last time any of this messing around is needed - I'm switching to a single archive for all shared-jy resources to ease the pain of any new files that are needed in the future. Please accept my apologies for the inconvenience!
 
@busch09, much more control. Much more graphs. :)
 
I get this message when i try to edit ntp.conf file (ntpMerlin option 3):
Code:
Choose an option:    3
ntpMerlin: Lock file found (age: 12 seconds) - stopping to prevent duplicate runs
and it returns to menu. ntp.conf file is not present in /tmp/etc
Actions described in post #913 i've done.
Router model and version in signature. Do you need any config/log files?
I uninstalled and reinstalled ntpMerlin, during installation:
Code:
Installing ntpd (4.2.8p13-4) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/ntpd_4.2.8p13-4_armv7-2.6.ipk
Configuring ntpd.
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
Not to mention router interface got restarted, causing loss of internet connection. As per Murphy's Law someone else on my family was doing something important - applying for the job. Talk about coincidences :mad:

I uninstalled ntpMerlin and installed it back again. Works now, i specified my router's IP as time server for Windows 10 - sync OK.
ntpq -p output:
Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ntp1.0x00.lv    193.204.114.233  2 u  50y   64    3  1584558  7922792 29153.0
 ntp4.0x00.lv    194.100.2.194    2 u  50y   64    3  1584558  7922792   0.002
 ntp3.0x00.lv    193.204.114.233  2 u  50y   64    3  1584558  7922792 29201.6
 wolf.netparks.l 194.58.203.148   2 u   28   64    3    2.620    0.398 5602259
I think ntpMerlin runs into issues when default NTP server is enabled on router and it has option "redirect all clients to router NTP" active.
It tries to disable it and then gets wonky. Just my guess... :confused:
 
Last edited:
I get this message when i try to edit ntp.conf file (ntpMerlin option 3):
Code:
Choose an option:    3
ntpMerlin: Lock file found (age: 12 seconds) - stopping to prevent duplicate runs
and it returns to menu. ntp.conf file is not present in /tmp/etc
Actions described in post #913 i've done.
Router model and version in signature. Do you need any config/log files?
I uninstalled and reinstalled ntpMerlin, during installation:
Code:
Installing ntpd (4.2.8p13-4) to root...
Downloading http://bin.entware.net/armv7sf-k2.6/ntpd_4.2.8p13-4_armv7-2.6.ipk
Configuring ntpd.
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
/jffs/scripts/ntpmerlin: line 1200: can't open /jffs/addons/ntpmerlin.d/ntpdstats_www.asp: no such file
Not to mention router interface got restarted, causing loss of internet connection. As per Murphy's Law someone else on my family was doing something important - applying for the job. Talk about coincidences :mad:

I uninstalled ntpMerlin and installed it back again. Works now, i specified my router's IP as time server for Windows 10 - sync OK.
ntpq -p output:
Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ntp1.0x00.lv    193.204.114.233  2 u  50y   64    3  1584558  7922792 29153.0
 ntp4.0x00.lv    194.100.2.194    2 u  50y   64    3  1584558  7922792   0.002
 ntp3.0x00.lv    193.204.114.233  2 u  50y   64    3  1584558  7922792 29201.6
 wolf.netparks.l 194.58.203.148   2 u   28   64    3    2.620    0.398 5602259
I think ntpMerlin runs into issues when default NTP server is enabled on router and it has option "redirect all clients to router NTP" active.
It tries to disable it and then gets wonky. Just my guess... :confused:
Wow, what a mess.

I disabled the firmware NTP daemon before installing ntpMerlin.

That ntpq output is not good.

Here is a sample ntp.conf to try
Code:
#
logfile /opt/var/spool/ntp/ntp.log
driftfile /opt/var/spool/ntp/ntp.drift
leapfile /opt/var/spool/ntp/leap-seconds.list # https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
#
restrict default limited kod nomodify notrap nopeer noquery # restrictive default IPv4
restrict -6 default limited kod nomodify notrap nopeer noquery # restrictive default IPv6
restrict source nomodify notrap noquery # required for pool directive if using restrictive default permissions
restrict 127.0.0.1 # permissive localhost IPv4
restrict -6 ::1 # permissive localhost IPv6
#
interface ignore wildcard
interface listen br0
#
pool time.cloudflare.com iburst
#
Check whether your LAN interface is br0
If you do not have Cloudflare in Latvia, then perhaps use "lv.pool.ntp.org" instead
 
Code:
==============================================================================
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 time.cloudflare .POOL.          16 p    -   64    0    0.000    0.000   0.000
-time.cloudflare 10.106.8.5       3 u   33   64  377    9.774    0.931   2.399
+time.cloudflare 10.106.8.5       3 u   41   64  377    8.192    0.281   5.064
-time.cloudflare 10.106.8.5       3 u   36   64  377    8.923    0.692   2.116
-time.cloudflare 10.106.8.5       3 u   19   64  377   10.830    1.450   6.800
==============================================================================
 
Thanks @EmeraldDeer! I removed local NTP servers, replacing them with "pool time.cloudflare.com iburst"
and ntpq -p output now looks good:
Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 time.cloudflare .POOL.          16 p    -   64    0    0.000    0.000   0.002
 time.cloudflare 10.151.8.4       3 u    1   64    1    2.693   -0.006 6468975
 time.cloudflare 10.151.8.4       3 u    1   64    1    2.741    0.068   0.007
Only 2 things still bothering me:
Code:
18 Mar 22:05:23 ntpd[5236]: kernel reports TIME_ERROR: 0x2041: Clock Unsynchronized
18 Mar 22:05:23 ntpd[5236]: kernel reports TIME_ERROR: 0x2041: Clock Unsynchronized
And time is off by 2 hours in this log. Should be 00:05, date command from CLI shows correct time, same for System log menu.
I did reboot router after configuring.
 
Last edited:
Thanks @EmeraldDeer! I removed local NTP servers, replacing them with "pool time.cloudflare.com iburst"
and ntpq -p output now looks good:
Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 time.cloudflare .POOL.          16 p    -   64    0    0.000    0.000   0.002
 time.cloudflare 10.151.8.4       3 u    1   64    1    2.693   -0.006 6468975
 time.cloudflare 10.151.8.4       3 u    1   64    1    2.741    0.068   0.007
Only 2 things still bothering me:
Code:
18 Mar 22:05:23 ntpd[5236]: kernel reports TIME_ERROR: 0x2041: Clock Unsynchronized
18 Mar 22:05:23 ntpd[5236]: kernel reports TIME_ERROR: 0x2041: Clock Unsynchronized
And time is off by 2 hours in this log. Should be 00:05, date command from CLI shows correct time, same for System log menu.
I did reboot router after configuring.
NTP only uses UTC. The local offset is left to your operating system to handle. In the case of your router, you need to get the settings correct in Administration --> Settings --> Basic Config
These get stored in nvram. Here are my settings
Code:
time_zone=EST5DST
time_zone_dst=1
time_zone_dstoff=M3.2.0/2,M11.1.0/2
time_zone_x=EST5DST,M3.2.0/2,M11.1.0/2
You need the Latvian settings

Edit: If the CLI time is correct, then that is not the problem. I think the ntp.log timestamps may be UTC. You are probably two time zones East of UTC.

Edit 2: I get the "TIME_ERROR: 0x2041: Clock Unsynchronized" error at bootup every time because there is no battery clock in these routers. When NTP makes the huge jump from firmware default, this error is generated. Not a problem.
 
Last edited:

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top