What's new

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!

kvic

Part of the Furniture
This will be a little package that provides a real Network Time Protocol daemon for your Merlin router and perhaps ASUSWRT too. It will keep your router's clock more accurate than you possibly ever want.

Why bother using it over the stock? Because it uses much less RAM than the NTP shipped in current ASUSWRT or Merlin and yet does much more and doing in a proper way.

It's also an add-on i.e. install to an existing firmware without re-compiling any software. Added bonus is a GUI showing a few charts. See the attached screenshot.

The background of this project goes back to this thread. It brought me lot of fun. And I thought some of the results can benefit all. Why not share?

If there is enough interest, I'll spend more time to pack up necessary components and write a little guide over the weekend...

Screenshot

x39xd1.jpg


Installation Guide

https://github.com/kvic-z/goodies-asuswrt/wiki/Install-NTP-Daemon-for-Asuswrt-Merlin

What's new in R3

stats-ntp-offset.png

stats-ntp-sysjit.png


Release R3 (2017-3-18)
  • NTP updated to 4.2.8p9-win.
  • New colour scheme and minor tweaks to RRD plots.
  • Added binary ntpdc for controlling ntpd without restart.
  • Retired MIPS package.
Update to R2 (2016-10-7)
  • NTP updated to release 4.2.8p8. Follow the instructions here and here to update only the ntp binaries.
Release R2 (2016-1-1)
  • Added a package for MIPS routers...RT-N66/AC66 users could try.
  • Removed jQuery from Ntpd asp page. More firmware version agnostic (hopefully...).
  • Corrected page title and "refresh" button.
  • Removed "restrict" directive in ntp.conf.
Common Issues and Workarounds

1. Shall I delete "NTP server" entry on Admin page after installing this package?

No. For details, go here.

2. My syslog is spammed with tonnes of crond messages at every 5 minutes. Help!

Solutions are always more than problems. Go here for details.

3. Is this package well supported?

I have stopped upgrading my RT-AC56U. Its firmware is frozen in a timeframe equivalent to 380.60 alpha 1. Hence, lot of compatibility things with newer firmwares I can't test nor confirm. Such support will depend on the community. However, this package was created with much effort to be version agnostic from the beginning. It's reasonable to expect this package shall continue to work.

That aside, NTP binaries and graph tweaks will be updated from time to time when I see the need or find something interesting and useful.

Be warned upfront though: you shall decide to install this package at your own risk and perhaps little frustration to some during the process.
 
Last edited:
This will be a little package that provides a real Network Time Protocol daemon for your Merlin router and perhaps ASUSWRT too. It will keep your router's clock more accurate than you possibly ever want.

Why bother using it over the stock? Because it uses much less RAM than the NTP shipped in current ASUSWRT or Merlin and yet does much more and doing in a proper way.
Hi,

The whole project and the charts (of course) are quite geeky, but I like to have precision on my devices! :D

If you find the time to prepare the installation package, I am more then happy to install it and to give you feedback.

With kind regards
Joe :cool:

PS.: My immediate "use case" is to use the precise time from the router and let it act as a time sever for my whole network... :rolleyes:
 
I got five gents with interest. Thanks!

I just texted joegreat a link for pilot testing the installation..a bit manual and involved. I tried to be as few steps as possible. Let's see how smooth he proceeds with the guide.

Keep tuned..
 
Sorry to keep interested folks waiting. Here is a revised installation guide:
  • [please refer to #1 for the link to installation guide]
I ran throught it once to ensure not to cause trouble to brave souls jumping onto this goodies. It installs and runs well on my AC56U with 378.55. I also checked to ensure it'll work with common firmware versions such as 378.56 and 374.43. I expect it to work with any version in between.

Hopefully the whole user experience will be smooth for you.

The binaries (ntpd & ntpq) are ARM only at the moment. The rest is applicable to both ARM and MIPS.

If people decide to take a ride, will appreciate hearing feedback whether works or not for your router.

Cheers

Thanks to joegreat for testing the initial version. It was a bumpy ride...

EDIT: Removed outdated link.
 
Last edited:
Sorry to keep interested folks waiting. Here is a revised installation guide:
I ran throught it once to ensure not to cause trouble to brave souls jumping onto this goodies. It installs and runs well on my AC56U with 378.55. I also checked to ensure it'll work with common firmware versions such as 378.56 and 374.43. I expect it to work with any version in between.

Hopefully the whole user experience will be smooth for you.

The binaries (ntpd & ntpq) are ARM only at the moment. The rest is applicable to both ARM and MIPS.

If people decide to take a ride, will appreciate hearing feedback whether works or not for your router.

Cheers

Thanks to joegreat for testing the initial version. It was a bumpy ride...

Installed this morning on RT-AC87R with Merlins 56_2. Only change I had to make was to the config file /jffs/etc/ntp.conf where I changed the line interface listen to ip.address.of.my.router

You may want to add that to the wiki.

Works great!

Thanks
 
Last edited:
Nice catch on the "interface listen." I updated the guide. Thanks.

Glad to hear it works for you!

Installed this morning on RT-AC87R with Merlins 56_2. Only change I had to make was to the config file /jffs/etc/ntp.conf where I changed the line interface listen to ip.address.of.my.router

You may want to add that to the wiki.

Works great!

Thanks
 
Thanks for doing this. Pretty cool. Only issue I see is that when I go to the NTP daemon tab (my.router.ip.address/Tools_NtpdStats.asp), it seems to cut off the top tabs and everything down to (and including) the "Last 24 Hours" label at the top of the first chart. Might be something I did wrong in my setup, but I can't think of what that might be.

Cheers,
Todd
 
Thanks for trying this package. I understand the problem you described. If the asp file is intact, it's unlikely to happen.

378.54 is very similar to 55 or 56. I doubt it's due to variation between versions. When you get the chance, can you open Web Inspector in your PC browser and message me the content of the asp file? I can check for clues causing the problem..


Thanks for doing this. Pretty cool. Only issue I see is that when I go to the NTP daemon tab (my.router.ip.address/Tools_NtpdStats.asp), it seems to cut off the top tabs and everything down to (and including) the "Last 24 Hours" label at the top of the first chart. Might be something I did wrong in my setup, but I can't think of what that might be.

Cheers,
Todd
 
For what it's worth, I tried un-installing and re-installing, but the NTP Daemon tab is still the same. I tried Firefox, Chrome and IE, all with the same results.

This is on my "main" router (shown in signature below) that has not had the NTP time issue that I mentioned in another thread, which affected my WDS bridged router . This one is the RT-AC87R running Merlin 378.54_2 firmware.



On another note: I did notice that there seems to be a typo in the instructions for the cron:

Code:
cru a NtpdStats "*/5 * * * * /jffs/bin/ntpstats.sh"
shouldn't it read like this:
Code:
cron a NtpdStats "*/5 * * * * /jffs/bin/ntpstats.sh"
 
Last edited:
"cru" is a built in script used to add an entry to crontab

Code:
Cron Utility
add:    cru a <unique id> <"min hour day month week command">
 
"cru" is a built in script used to add an entry to crontab

Code:
Cron Utility
add:    cru a <unique id> <"min hour day month week command">

Ah ok, I did a quick google search but didn't find anything. I'll change it back in the services-start file.
Thanks
 
Regarding the garbled NTP Daemon page on 378.54_2, exchanged information with Todd offline in the past two days .

EDIT 2:

Forget about the crap in /www before 378.55. Figured out the root cause.

A fix for 378.54_2 is being tested.
 
Last edited:
Sorry to keep interested folks waiting. Here is a revised installation guide:
I ran throught it once to ensure not to cause trouble to brave souls jumping onto this goodies. It installs and runs well on my AC56U with 378.55. I also checked to ensure it'll work with common firmware versions such as 378.56 and 374.43. I expect it to work with any version in between.
Hi,

First of all: Thank you for your effort and the great add-on! :)

The installation guide works fine, but still I would like to bring to your attention two (small) topics:
- The configuration file /jffs/etc/ntp.conf has the router IP address in it (default 192.168.1.1), but if the router is set to something else you get no error, but it does not work...
Please add the router IP check/update into your guide!
- What does the error message mean: 'restrict: ignoring line 11, address/host 'lo' unusable.'?
The next line says: 'Listen normally on 0 lo 127.0.0.1:123'

With kind regards
Joe :cool:
 
interface listen br0

Nice. This is apparently a better default for us, Asus routers

Please add the router IP check/update into your guide!

- What does the error message mean: 'restrict: ignoring line 11, address/host 'lo' unusable.'?The next line says: 'Listen normally on 0 lo 127.0.0.1:123'

Hope you had a great biz trip!

I did add a line to the paragraph on ntp.conf in the guide about changing "interface listen" after HardCat pointed it out. Probably should have made it into a step..

"lo" is not valid interface name for Asus routers. "restrict br0" is perhaps better. Since NTPD by the provided ntp.conf only listens on private ipv4 address, the line isn't essential. So I never dig into too much.

I'm going to update ntp.conf with:
Code:
restrict br0
interface listen br0

Toddimus also confirmed the fix of garbled NTP page working for 378.54_2. It's a one-line change in the asp file. It will fix for all version before 378.55 down to 374.43.

EDIT:

tarbar on Github updated.
 
Last edited:
Toddimus also confirmed the fix of garbled NTP page working for 378.54_2. It's a one-line change in the asp file. It will fix for all version before 378.55 down to 374.43.
Do tell....enquiring minds want to know :)
 
Do tell....enquiring minds want to know :)

I had to add back jQuery.noConflict() in initial() before show_menu() is called inside it.

This will free up the $ operator which is apparently used by jQuery in my asp file..

My guess in versions before 378.55, jQuery and another library are both overloading $ operator. Hence, each in turn has to relinquish the other when it wants to use $(...).

I believe this has been cleaned up since 378.55. Don't count on me. I've been a web developer for 7 days :)
 
"lo" is not valid interface name for Asus routers. "restrict br0" is perhaps better.

If it don't work, try this:
Code:
restrict router.asus.com
interface listen br0

I think his log error was because "lo" could not be resolved to an IP address in the line, "restrict lo".

However, my log shows that "interface listen lo" is valid because "lo" is a valid interface. Check your /tmp/syslog.log.
 
However, my log shows that "interface listen lo" is valid because "lo" is a valid interface. Check your /tmp/syslog.log.

omg..I also have lo:
Code:
$ ifconfig lo
lo         Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING MULTICAST  MTU:16436  Metric:1
           RX packets:251739 errors:0 dropped:0 overruns:0 frame:0
           TX packets:251739 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:134096062 (127.8 MiB)  TX bytes:134096062 (127.8 MiB)
 
Hope you had a great biz trip!
Hi,

Trip was stressful but OK - have another one next week to complete the work - then I am done with trips for the rest of the year! ;)
I'm going to update ntp.conf with:
Code:
restrict br0
interface listen br0
Thank you very much! Works like a charm! :D

With kind regards
Joe :cool:
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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