Recipe 19.3. Connecting to a Local Time Server

 < Day Day Up > 

19.3.1 Problem

You were tired of seeing a different incorrect time on every machine in your shop. So you set up a local time server now how do you connect the clients?

19.3.2 Solution

Install or update ntp on the client PCs, and make sure the ntp daemon is not running:

# /etc/init.d/ntpd stop

On Debian, use:

# /etc/init.d/ntp-server stop

Edit /etc/ntp.conf to point to the local time server:

# /etc/ntp.conf driftfile  /etc/ntp.drift logfile  /var/log/ntp.logdriftfile     #use either hostnames or IPs server 192.168.1.101

You can also include a fallback, in case the time server becomes unavailable:

# local fudge if network servers not available # stratum 10 means low priority server  127.127.1.0 fudge   127.127.1.0 stratum 10

ntp will continue to keep the time, based on past performance, until the server becomes available.

Now run ntpdate, pointing to the local server:

# ntpdate 192.168.1.101

Start up ntpd:

# /etc/init.d/ntpd start

On Debian, use:

# /etc/init.d/ntp-server start

Again, it may take a few minutes for a query to show any results:

# ntpq -p  remote refid st t when poll reach delay offset jitter  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =   =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  *clock.sjc.he.ne .CDMA. 1 u 21 64 377 98.269 15.298 4.000

19.3.3 Discussion

It is a good practice to also add some access controls; see the next recipe for /etc/ntp.conf access rules and some sample iptables rules.

Windows clients should use the free Automachron sntp (Simple Network Time Protocol) client. It works on all versions of Windows, is easy to configure, and is free of cost (although if you use it, it would be a nice gesture to click the PayPal link on the author's web site and send him a few dollars). Download it from http://www.oneguycoding.com/automachron.

Automachron has a nice feature for dialup connections the "Wait for dialup connection" setting. It won't attempt to synchronize until a connection is established. It is also easy to set the synchronization intervals.

19.3.4 See Also

  • Recipe 19.4

  • Your local documentation at /usr/share/doc/ntp-doc/html, or online at http://www.ntp.org/documentation.html

  • The ntp.org web site (http://www.ntp.org)

  • The Usenet group comp.protocols.time.ntp

     < Day Day Up > 


    Linux Cookbook
    Linux Cookbook
    ISBN: 0596006403
    EAN: 2147483647
    Year: 2004
    Pages: 434

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net