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?
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.
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
tcpdump port 123 -i
ntpdate might need to be install
opkg install ntpdate
These tools are not included by default.
The OP could run that on a client.
Server is not running
root@OpenWrt:~# netstat -lnp |grep 123
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: no server suitable for synchronization found
$ sudo ntpdate -q 0.openwrt.pool.ntp.org
server 18.104.22.168, stratum 2, offset 0.942723, delay 0.04248
server 22.214.171.124, stratum 2, offset 0.935283, delay 0.06239
server 126.96.36.199, stratum 3, offset 0.941215, delay 0.04973
server 188.8.131.52, stratum 2, offset 0.944880, delay 0.04431
16 Mar 15:45:39 ntpdate: step time server 184.108.40.206 offset 0.942723 sec
$ sudo ntpdate -q 1.openwrt.pool.ntp.org
server 220.127.116.11, stratum 3, offset 0.939904, delay 0.04980
server 18.104.22.168, stratum 3, offset 0.936377, delay 0.05733
server 22.214.171.124, stratum 3, offset 0.940961, delay 0.05429
server 126.96.36.199, stratum 2, offset 0.940969, delay 0.04736
16 Mar 15:45:57 ntpdate: step time server 188.8.131.52 offset 0.940969 sec
Nothing is happening on port 123. Apparently, the NTP server is not running.
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
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: step time server 184.108.40.206 offset +0.185742 sec
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
Are you running a snapshot by chance?
seems to be the solution. Of course, I swear I did not touch any of those configurations before . 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
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.