Network Time Protocol (NTP) configuration

Controller is VeraPlus (FW 1.7.5186 (7.31))

Configuring NTP to use a time server (UPS backed QNAP NAS) running on my internal network as well as the default time servers (N.openwrt.pool.ntp.or g). Result would be the controller configuring its date and time using the NAS if my Internet connection is not operating.

The operating system configuration file is /etc/config/system (space added in ‘org’ to prevent the editor forming a hyperlink):
config system
option hostname ‘MiOS_NNNNNNNN’
option timezone ‘CST6CDT,M3.2.0,M11.1.0’

config timeserver ‘ntp’
list server ‘0.openwrt.pool.ntp.or g’
list server ‘1.openwrt.pool.ntp.or g’
list server ‘2.openwrt.pool.ntp.or g’
list server ‘3.openwrt.pool.ntp.o rg’
option enabled ‘1’
option enable_server ‘0’

I have two choices. Make a backup of the system file, then add a line in the system file for the NAS:
list server '192.168.1.200’
then reboot the controller (or restart the NTP daemon)

or

Issue the following commands:
uci add_list system.ntp.server=‘192.168.1.200’
uci commit system
then reboot the controller (or restart the NTP daemon)

Both choices should accomplish the same outcome, correct?

Sources: https://www.toggledbits.com/static/reactor/docs/3.6/Clock-Validity/
https://openwrt.org/docs/guide-user/advanced/ntp_configuration
https://openwrt.org/docs/guide-user/services/ntp/client-server
https://openwrt.org/docs/guide-user/services/ntp/client

You need to do both. You should use uci to make the changes, for example:

uci set ntpclient.@ntpserver[0].hostname="LOCALNTPSERVERIP1"
uci set ntpclient.@ntpserver[1].hostname="LOCALNTPSERVERIP2"
uci commit ntpclient
/etc/init.d/ntpclient restart
uci set system.ntp.server="LOCALNTPSERVERIP1"
uci add_list system.ntp.server="LOCALNTPSERVERIP2"
uci commit system.ntp
/etc/init.d/sysntpd restart

Thank you rigpapa.

I’ll be appending to the current server list (N.openwrt.pool.ntp.or g) creating a fifth server. Currently there are four servers referenced (uci show ntpclient, uci show system.ntp). I believe, therefore, the commands are:

#To update /etc/config/ntpclient
uci set ntpclient.@ntpserver[4].hostname=“192.168.1.200”
uci commit ntpclient
/etc/init.d/ntpclient restart

#To update /etc/config/system
uci add_list system.ntp.server=“192.168.1.200”
uci commit system.ntp
/etc/init.d/sysntpd restart

In practice, the first server is usually the only one used. Ntpclient isn’t very smart, and sysntpd isn’t really configured to do anything.

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules