Article Title: Set the Linux time server in the LAN. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I. Overview:
This article aims to briefly introduce how to set a Linux time server on the LAN to synchronize with the time server on the Internet, and how to synchronize other Linux and Windows users on the LAN to the Linux time server.
2. Server Settings
First, we will explain how to set the time server on the LAN to synchronize with the first or second-level time servers on the Internet to ensure accurate time.
1. How to synchronize the LAN time server (level 3) with the time server (level 1 or Level 2) on the Internet
A. XNTP package is included in most Linux CD.
Home page in 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 time server domain name from the home page above. For example
Server rackety.udel.edu
Server umd1.umd.edu
Server lilben.tn.cornell.edu
Driftfile/etc/ntp/drift
Then start The XNTPD background program
#/Etc/rc. d/init. d/xntpd start
B. "getdate" is recommended for small programs that come with Slackware. In most cases, we do not have very strict requirements on time accuracy, so this program is fully adequate and convenient.
Download ftp://metalab.unc.edu/pub/Linux/system/network/misc/getdate_rfc868-1.2.tar.gz
Then set the following scripts to get the name/usr/local/sbin/get-date.sh
#! /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 synchronize every hour
0 0-23 ***/usr/local/sbin/get-date.sh
2. How to synchronize other linux/windows users on the LAN with this server
A. If the time server is also a Samba server on the LAN, you do not need to install any time synchronization software for Windows, because windows users can use
Net time \ timeserver/set/yes to synchronize with it. You can run this command on startup
Automatic synchronization during windows Startup
Net time command uses Netbios over TCP/IP protocol to synchronize time
But it is only valid for Windows customers and Linux users cannot use it.
B. If the server runs the NTP backend service program, such as The XNTPD mentioned earlier
Windows:
You can install the following two free software to synchronize with the server.
Http://home.att.net /~ Tom. Horsley/ntptime.html (ntptime)
A single background program automatically searches for NTP servers on the LAN. You can set synchronization conditions in the control panel.
Http://nettime.sourceforge.net/(Nettime)
Supports NTP (udp/123), time (udp/37), and time (tcp/37)
Linux:
Ntpdate (with XNTPD) can be used as a cronjob to synchronize with the time server on the LAN.
C. If the server uses getdate to synchronize with the time server on the internet
You can set/etc/inetd. conf to enable the time udp and time tcp services so that users in linux/windows can synchronize with them. For windows, you can use the Nettime software as described above.
For Linux customers, you can use rdate-s to run as a cronjob to synchronize with it.
Time stream tcp nowait root internal
Time dgram udp wait.200 root internal
The rdate-s command in Linux uses time (37/tcp). For Nettime, you can specify 37/tcp or 37/udp
3. FAQ
1. How can I determine if Netbios over TCP/IP is used for net time?
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 do I determine that ntptime is being synchronized with the Linux NTP time server in the background?
Run on NTP server
# Tcpdump udp port 123
View output
By default, ntptime is queried from the NTP server every five minutes. You can download the control condition setting program in the control panel from the home page.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service