NTP Network Time Protocol How To

From RidgeRun Developer Connection

(Difference between revisions)
Jump to:navigation, search
(Server Configuration)
m (Client / Server Configuration)
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>
 +
pgrep ntpd
 +
</pre>
 +
 
 +
If a number is returned (the PID for the <tt>ntpd</tt> daemon), then your configuration is correct.
 +
 
 +
 
 +
== Client Configuration==
 +
 
 +
A target device is configured in client mode as follows
<pre>
<pre>
Line 20: Line 33:
echo "driftfile /tmp/ntp_drift" >> /etc/ntp.conf
echo "driftfile /tmp/ntp_drift" >> /etc/ntp.conf
echo "iburst" >> /etc/ntp.conf
echo "iburst" >> /etc/ntp.conf
-
 
chmod ugo+r /etc/ntp.conf
chmod ugo+r /etc/ntp.conf
 +
 +
echo "ntp            123/tcp" >> /etc/services
 +
echo "ntp            123/udp >> /etc/services
</pre>
</pre>

Revision as of 16:39, 8 September 2010

Most of the text in this How to is taken from the massively documented NTP package.

Contents

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

Client Configuration

A target device is configured in client mode as follows


using the server (sic) command and specifying the server DNS name or IPv4 or IPv6 address; the server requires no prior configuration. The iburst option described later on this page is recommended for clients, as this speeds up initial synchronization from several minutes to several seconds. The burst option described later on this page can be useful to reduce jitter on very noisy dial-up or ISDN network links.

Ordinarily, the program automatically manages the poll interval between the default minimum and maximum values. The minpoll and maxpoll options can be used to bracket the range. Unless noted otherwise, these options should not be used with reference clock drivers.

Navigation
Toolbox