User Tools

Site Tools


doc:howto:ntp.client

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
doc:howto:ntp.client [2012/07/27 21:03]
orca
doc:howto:ntp.client [2013/02/24 18:42] (current)
ghost added information for ntpd and busybox-ntpd
Line 37: Line 37:
 See [[doc:​techref:​opkg]] for more details on using the OpenWrt package manager. See [[doc:​techref:​opkg]] for more details on using the OpenWrt package manager.
  
-By default, **busybox-ntpd**,​ can supply both a client for setting time, and a server for supplying time to the local net.   ​This is installed out of the box and should take care of most time syncing needs.+By default, **busybox-ntpd**,​ can supply both a client for setting time, and a server for supplying time to the local net. This is installed out of the box and should take care of most time syncing needs. It doesnt support advanced features like query, so the server cannot be monitored from other systems like Nagios.
  
 Example (install the real ntpd package (=not busybox-ntpd):​ Example (install the real ntpd package (=not busybox-ntpd):​
Line 43: Line 43:
 opkg update opkg update
 opkg install ntpd opkg install ntpd
 +/​etc/​init.d/​sysntpd disable
 /​etc/​init.d/​ntpd enable /​etc/​init.d/​ntpd enable
 /​etc/​init.d/​ntpd start /​etc/​init.d/​ntpd start
-netstat -a+netstat -l | grep ntp
 </​code>​ </​code>​
  
-A ntpd server should be listening on the default NTP port (123).+When you use ntpd, make sure you disable sysntpd daemon. 
 +A ntpd server should be listening on the default NTP port (UDP 123).
  
 ===== Configuration ===== ===== Configuration =====
   * The busybox-ntpd is configured in ''​[[doc:​uci:​system|/​etc/​config/​system]]''​.   * The busybox-ntpd is configured in ''​[[doc:​uci:​system|/​etc/​config/​system]]''​.
  
-By default, it runs as a client and does not serve time.   A server can be enabled by adding the flag "​-l"​ to "local args" in /​etc/​init.d/​sysntpd (line 23).   This will most likely become configurable in a release post Backfire 10.3.1.+By default, it runs as a client and does not serve time to other peers.   A server can be enabled by adding the flag "​-l"​ to "local args" in /​etc/​init.d/​sysntpd (line 23). Starting with Backfire 10.3.1 ​this is not anymore needed and can be also changed in /​etc/​config/​system.
  
   * The package ''​ntpclient''​ is configured in ''​[[/​doc/​uci/​ntpclient|/​etc/​config/​ntpclient]]''​.   * The package ''​ntpclient''​ is configured in ''​[[/​doc/​uci/​ntpclient|/​etc/​config/​ntpclient]]''​.
  
  
-''​ntpdate''​ is a command line tool that usually is used for one time synchronizations:​+''​ntpdate''​ is a command line tool that usually is used for one time synchronizations ​with remote ntp peers:
 <​code>​ <​code>​
 ntpdate pool.ntp.org ntpdate pool.ntp.org
Line 64: Line 66:
 and also in conjuction with ''​[[doc:​howto:​notuci.config##​etccrontabsroot|/​etc/​crontabs/​root]]''​ and also in conjuction with ''​[[doc:​howto:​notuci.config##​etccrontabsroot|/​etc/​crontabs/​root]]''​
  
-ntpd is a daemon that runs all the time in the background for permanent synchronization.+  * ''​ntpd'' ​is a daemon that runs all the time in the background for permanent synchronization.
  
 According to [[http://​packages.debian.org/​squeeze/​ntp|Debian]] the same NTP daemon is also used to provide NTP service to other hosts. According to [[http://​packages.debian.org/​squeeze/​ntp|Debian]] the same NTP daemon is also used to provide NTP service to other hosts.
  
-To use ntpd as NTP client daemon, no change to the firewall is required, to run as NTP server daemon, open port 123 UDP for your NTP clients.+To use ntpd as NTP client daemon, no change to the firewall is required, to run as NTP server daemon, open port 123 UDP for your NTP clients ​(which is by default open in LAN)An example to run ''​ntpd''​ as a server: 
 + 
 +<​code>​ 
 +driftfile ​ /​var/​lib/​ntp/​ntp.drift 
 + 
 +server 0.openwrt.pool.ntp.org iburst 
 +server 1.openwrt.pool.ntp.org iburst 
 +server 2.openwrt.pool.ntp.org iburst 
 +server 3.openwrt.pool.ntp.org iburst 
 + 
 +#exchange time with everybody but dont allow configuration (noquery to forbid query) 
 +restrict -4 default kod notrap nomodify nopeer 
 +restrict -6 default kod notrap nomodify nopeer 
 + 
 +#local users may interrogate the ntp server more closely 
 +restrict 127.0.0.1 
 +restrict ::1 
 +</​code>​
  
 ===== rdate server ===== ===== rdate server =====
doc/howto/ntp.client.txt · Last modified: 2013/02/24 18:42 by ghost