NTP Network Time Protocol How To: Difference between revisions
(One intermediate revision by the same user not shown) | |||
Line 11: | Line 11: | ||
== Server Configuration == | == Server Configuration == | ||
For a Ubuntu host acting as an NTP server, | For a Ubuntu host acting as an NTP server, typically nothing needs to be done, beyond grabbing the IP address. | ||
Do verify <tt>ntpd</tt> is running: | |||
<pre> | <pre> | ||
pgrep ntpd | |||
</pre> | |||
If a number is returned (the PID for the <tt>ntpd</tt> daemon), then your configuration is correct. | |||
== Client Configuration== | == Client Configuration== | ||
Line 29: | Line 27: | ||
<pre> | <pre> | ||
NTP_SERVER=10.111.0.3 | |||
echo "server $NTP_SERVER" > /etc/ntp.conf | |||
echo "statsdir /tmp/ntp_statistics" >> /etc/ntp.conf | |||
echo "driftfile /tmp/ntp_drift" >> /etc/ntp.conf | |||
echo "iburst" >> /etc/ntp.conf | |||
chmod ugo+r /etc/ntp.conf | |||
echo "ntp 123/tcp" >> /etc/services | |||
echo "ntp 123/udp >> /etc/services | |||
</pre> | </pre> | ||
[[Category:Whitepaper]] | [[Category:Whitepaper]] |
Revision as of 16:40, 8 September 2010
Most of the text in this How to is taken from the massively documented NTP package.
Overview
The Network Time Protocol (NTP) is widely used to synchronize a computer to Internet time servers. It can also be used as a server for dependent clients. It provides accuracies typically less than a millisecond on LANs and up to a few milliseconds on WANs.
Client / Server Configuration
Client/server mode is the most common configuration in the Internet today. It operates in the classic remote-procedure-call (RPC) paradigm with stateless servers and stateful clients. In this mode a host sends a client (mode 3) request to the specified server and expects a server (mode 4) reply at some future time. In some contexts this would be described as a "pull" operation, in that the host pulls the time and related values from the server.
Server Configuration
For a Ubuntu host acting as an NTP server, typically nothing needs to be done, beyond grabbing the IP address.
Do verify ntpd is running:
pgrep ntpd
If a number is returned (the PID for the ntpd daemon), then your configuration is correct.
Client Configuration
A target device is configured in client mode as follows
NTP_SERVER=10.111.0.3 echo "server $NTP_SERVER" > /etc/ntp.conf echo "statsdir /tmp/ntp_statistics" >> /etc/ntp.conf echo "driftfile /tmp/ntp_drift" >> /etc/ntp.conf echo "iburst" >> /etc/ntp.conf chmod ugo+r /etc/ntp.conf echo "ntp 123/tcp" >> /etc/services echo "ntp 123/udp >> /etc/services