Time server in Linux
In the Redhat Linux AS 3.0 operating system, we can use NTP (Network Time Protocol) to build a local logo time server.
In the ASP platform, there are more than 40 servers, the operating system has Redhat Linux AS 3.0, Microsoft Windows 2000 Server, Microsoft Windows 2003 Enterprise Server, Solaris 9, AIX 5.1, etc. Time to set, so that the time on each server will produce a large gap, the time of time will definitely affect our app, sometimes there will even bring some adverse consequences, such as affecting our backup, affecting us Update of the database, etc. Most of the server in the ASP platform cannot connect to the public network, that is, it is not possible to synchronize the local time of the public network, so it is necessary to select a machine that can connect to the public network in the ASP platform. This time server timed with the public network time server, and all servers in the ASP platform are synchronized with the time server.
Step 1: Check if there is a corresponding package in the Linux system:
#rpm -qa | GREP NTP
NTP-4.1.1A-9
ChkFontPath-1.9.6-3
If there is no NTP package, put it from the disc. Perform the following command to install the NTP RPM package:
# rpm -ivh ntp-4.1.1a-9.i386.rpm (I use RedHat8.0, please install the corresponding package according to your actual situation)
Step 2: Modify the configuration file
/etc/ntp.conf is the main configuration file of NTP, which sets the domain name or IP address of the time server you use to synchronize time. The following is the most basic configuration to the Internet synchronization time:
First let's define your favorite time servers: (available time server, see
Http://chinaunix.net/jh/5/100591.html, or see:
http://www.eecis.udel.edu/~mills/NTP/Servers.html)
Server time.windows.com.com
Server ntp1.sf-bay.org
Next, we set the access rights of the above two servers. In this example we do not allow them to modify or query the NTP server we are configured on Linux.
Restrict time.windows.com Mask 255.255.255.255 Nomodify NOTLAP NOQUERY
Restrict ntp1.sf-bay.org mask 255.255.255.255 Nomodify NOTLAP NOQUERY
Description: Mask 255.255.255.255 is used to limit the mask address of the remote NTP server.
Then set the intranet machine that allows access. Please note that NOQuery in the configuration has been removed:
Restrict 192.168.1.0 mask 255.255.255.0 Notrust Nomodify Notrap
In this example, the mask address is extended to 255, so our NTP server can be used to synchronize using our NTP server from 192.168.1.1-92.168.1.254. If you want to limit more strict, you can modify your mask.
Finally, it is also the most important thing that the default restriction configuration is to be removed from your configuration file, otherwise it will overwrite all your configuration options, you will find that your time server will only communicate with your time if you do not delete it. If you have the following lines in ntp.conf, please commented it: # Restrict default ignore
Step 3: Check availability
a. Save your profile and then check the query command for each time server configured in NTP.CONF, make sure these upstream time servers are available.
# Ntpdate time.windows.com
27 Jun 10:12:01 NTPDATE [25475]: Adjust Time Server 133.100.11.8 Offset -0.127154 SEC
# Ntpdate ntp1.sf-bay.org
27 Jun 10:12:06 NTPDATE [25478]: Adjust Time Server 133.100.9.2 Offset 0.010008 SEC
b. Execute the following command
# Ntpq -p
...... ...... Output
A evidence that can prove synchronization problem is that all the Jitter values of all remote servers are 4000 and the value of delay and reach are 0.
Remote Refid St Twhen Poll Reach Delay Offset Jitter
============================================================================================================================================================================================================= ============================
Local (0) Local (0) 10 L - 64 7 0.000 0.000 0.008
* 0.0.0.0 16 U - 64 0 0.000 0.000 4000.00
Step 4: Set self-start
In order to enable NTP services to automatically start when system boot, execute:
# ChkConfig NTPD ON
The command to start / close / restart NTP is:
# /Etc/init.d/ntpd start
# /Etc/init.d/ntpd stop
# /Etc/init.d/NTPD Restart
Step 5: Client settings
a.Linux client
Log in as root, execute NTPDATE 61.152.112.13: Can you synchronize with the time server, then execute crontab -e input
00 02 * * * / usr / sbin / ntpdate 61.152.12.13 (replaced with your Time Server IP), this will automatically synchronize with Time Server at two o'clock every day.
B.Windows XP client
Double-click the time, "Date and Time Properties" window, select the Internet time, enter your Time Server IP in the server column, click "Update Now", you will be able to see the update success in a few seconds. prompt. Then check "Automatic and Internet Time Server Synchronization". Click OK. At this point, the setting of the REDHAT Linux AS 3.0 and its client settings will be completed, all ASP platforms will be synchronized, ensuring the normal operation of various application systems and platforms.