NTP server through busybox-ntp

Hello,
My system is set that every computer and the router is using an internet ntp provider for obtaining the actual time. I would like change this so that only the router is acting as ntp client to internet ntp server and at the same time as ntp server for machines within my LAN.

I saw a couple of posts on this, some suggest to replace the busybox-ntp tools with ntpd, some say this would not be neccessary. My preference would be to use the default apps.

I started with activation of the server:

cat /etc/config/system |grep server config timeserver 'ntp' list server '0.openwrt.pool.ntp.org' list server '1.openwrt.pool.ntp.org' list server '2.openwrt.pool.ntp.org' list server '3.openwrt.pool.ntp.org' option enable_server '1'

The /etc/init.d/sysntpd has been started. But now, how would I go from here?

On the PC I set the ntp server's IP address to the router's IP address. But syncing returns a no-ntp-server-found.

Has anybody succeeded in this and can share the correct settings?

Cheers
Oscar

Verify that the server is listening: netstat -lnp | grep 123
I suppose this is for lan and you have not changed the lan zone firewall settings.

2 Likes

you can check your time server localy:
ntpdate -q localhost

what is the offset compare to the upstrime servers:
ntpdate -q 0.openwrt.pool.ntp.org
ntpdate -q 1.openwrt.pool.ntp.org
...

actual communication:
tcpdump port 123 -i

ntpdate might need to be install
opkg update
opkg install ntpdate

These tools are not included by default.

The OP could run that on a client.

1 Like

Server is not running

root@OpenWrt:~# netstat -lnp |grep 123
root@OpenWrt:~#

Nothing, nada, niente

Same output on router and client:

sudo tcpdump port 123
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlan0, link-type EN10MB (Ethernet), capture size 262144 bytes

On the client

$ sudo ntpdate -q localhost
16 Mar 15:44:46 ntpdate[14071]: no server suitable for synchronization found

$ sudo ntpdate -q 0.openwrt.pool.ntp.org
server 195.186.1.101, stratum 2, offset 0.942723, delay 0.04248
server 178.209.53.202, stratum 2, offset 0.935283, delay 0.06239
server 162.159.200.123, stratum 3, offset 0.941215, delay 0.04973
server 82.197.188.130, stratum 2, offset 0.944880, delay 0.04431
16 Mar 15:45:39 ntpdate[14093]: step time server 195.186.1.101 offset 0.942723 sec

$ sudo ntpdate -q 1.openwrt.pool.ntp.org
server 162.159.200.123, stratum 3, offset 0.939904, delay 0.04980
server 45.157.190.152, stratum 3, offset 0.936377, delay 0.05733
server 162.159.200.1, stratum 3, offset 0.940961, delay 0.05429
server 192.33.214.47, stratum 2, offset 0.940969, delay 0.04736
16 Mar 15:45:57 ntpdate[14095]: step time server 192.33.214.47 offset 0.940969 sec

Nothing is happening on port 123. Apparently, the NTP server is not running.
Check:

cat /etc/config/system |grep server
config timeserver 'ntp'
        list server '0.openwrt.pool.ntp.org'
        list server '1.openwrt.pool.ntp.org'
        list server '2.openwrt.pool.ntp.org'
        list server '3.openwrt.pool.ntp.org'
        option enable_server '1'

/etc/init.d/sysntpd restart ; sleep 1 ; netstat -lnp | grep 123
If it is still not running logread | grep ntp

1 Like

The server is definitely not running. Here the excerpt from the log

Tue Mar 16 10:51:03 2021 daemon.info procd: Instance sysntpd::instance1 s in a crash loop 6 crashes, 0 seconds since last crash
Tue Mar 16 11:16:56 2021 daemon.info procd: Instance sysntpd::instance1 s in a crash loop 7 crashes, 0 seconds since last crash
Tue Mar 16 11:20:31 2021 daemon.info procd: Instance sysntpd::instance1 s in a crash loop 6 crashes, 0 seconds since last crash
Tue Mar 16 11:20:59 2021 daemon.info procd: Instance sysntpd::instance1 s in a crash loop 7 crashes, 0 seconds since last crash
Tue Mar 16 11:21:29 2021 daemon.info procd: Instance sysntpd::instance1 s in a crash loop 6 crashes, 0 seconds since last crash
Tue Mar 16 15:40:28 2021 daemon.notice ntpdate[11880]: step time server 134.34.3.19 offset +0.185742 sec

Crash loop,interesting....

Take a configuration backup, then reset router to default settings. Upon reboot in clean configuration setup the internet connection and enable the ntp server.
Provide also the following ubus call system board

1 Like

Are you running a snapshot by chance?

Its embarrassing.

seems to be the solution. Of course, I swear I did not touch any of those configurations before :wink:. Luckily, I have another OpenWRT Device as playground, so checked it quickly without risking uproar of my internet users.

Nope, regular stable build. Though I'd like to try the customised one from @tomtom

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.