Setting up the Linux system time server in the LAN

  

An overview:

The main purpose of this paper is to briefly explain how to set up a Linux time server on the LAN to synchronize with the time server on the Internet and how to make other LANs Linux and Windows clients synchronize to the Linux time server.

2 Server Settings

First, how do we set up the time server on the LAN to synchronize with the first or second time server on the Internet to ensure accurate time.

1. How to synchronize the LAN time server (level 3) with the time server (first or second level) on the Internet

a. XNTP package, included in most Linux Inside the CD. The home page is at http://www.eecis.udel.edu/~ntp/You only need to set the server and driftfile parameters in /etc/ntp.conf. You can find the public server from the above home page. Time server domain name. For example,

server rackety.udel.edu
server umd1.umd.edu
server lilben.tn.cornell.edu
driftfile /etc/ntp/drift

Then Start XNTPD daemon

#/etc/rc.d/init.d/xntpd start

b. getdate, a small program that comes with Slackware, recommended to use, most of the time, we The accuracy requirements for time are not very demanding, so this program is completely adequate and convenient. Download: ftp://metalab.unc.edu/pub/Linux/system/network/misc/getdate_rfc868-1.2.tar.gz and set the following scripts to be named /usr/local/sbin/get-date.sh< Br>

#!/bin/sh
timehosts=otc2.psu.edu wwvb.erg.sri.com ntp.nasa.gov
if /usr/local/bin/getdate -adjust 10 200 $ Timehosts /dev/null; then
/sbin/clock --systohc
fi

Now you can set cronjob to sync every hour

0 0-23 * * * /usr /local/sbin/get-date.sh

2. How to synchronize other Linux/windows clients on the LAN with the server

a. If the time server is also Samba on the LAN Server, for Windows, there is no need to install any time synchronization software, because windows customers can use net time \\timeserver /set /yes to synchronize with it. You can put this command to automatically synchronize when you start windows in startup. The net time command uses the Netbios over TCP/IP protocol to synchronize time, but only for Windows clients, and is not available to Linux customers.

b. If the server is running the NTP daemon, such as the XNTPD mentioned earlier, you can install the following two free software to synchronize with the server: http://home.att.net/~Tom. Horsley/ntptime.html (ntptime) A single daemon that automatically looks for an NTP server on the LAN. You can set the synchronization condition in the control panel, http://nettime.sourceforge.net/(Nettime). Support NTP (udp/123), time (udp/37), time (tcp/37). Linux: You can use ntpdate (with XNTPD) to run as a cronjob to synchronize with the time server on that LAN.

c. If the server uses getdate to synchronize with the time server on the Internet, you can set /etc/inetd.conf to open the time udp and time tcp services to synchronize with the linux/windows client. For windows, you can use the Nettime software as described above. For Linux clients, you can use rdate -s to run as cronjob with it:

time stream tcp nowait root internal
time dgram udp wait.200 root internal

rdate under Linux The -s command uses time (37/tcp), Nettime you can specify 37/tcp or 37/udp

three FAQs

1. How to determine the net time is Netbios over TCP/IP

Run tcpdump on the Samba server

# /usr/sbin/tcpdump host 192.168.1.3

(192.168.1.3 is the IP address of the windows client)

2. How to determine the windows NTP client ntptime is synchronizing with the Linux NTP time server in the background?

Running on NTP server

# tcpdump udp port 123

Viewing output

The default is to query NTP server once every five minutes ntptime, you can Download the Control Condition Setup program in the Control Panel from the home page.

Copyright © Windows knowledge All Rights Reserved