Installing NTP
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.6p3.tar.gz
Tar ntp-4.2.6p3.tar.gz
CD NTP-4.2.6P3
./configure--PREFIX=/USR/LOCAL/NTP--enable-all-clocks--enable-parse-clocks
Make
Make install
cp/usr/local/ntp/bin/*/usr/bin/
modifying ntp.conf configuration Files
First of all, to understand the ntp.conf inside involved parameter description
About the permission set part; Permissions are set primarily by restrict this parameter
The format is as follows:
Restrict IP address mask subnet mask parameter; Where IP can be IP address, can also be default, default
This means that all of the IP parameters are:
Ignore: Turn off all NTP Online Services
Nomodify: Client cannot change the time parameter of the server, but the client can use the server to do the network school
Notrust: Client sources will be treated as untrusted subnets unless authenticated
Noquery: Do not provide a client's time query
Note: If the parameter is not set, it means that there is no limit to the IP (or subnet)
Use server this parameter to set up the superior time server
The format is as follows: Server IP address or domain name [prefer]
IP address or domain name is our designated superior time server, if the server parameter finally plus prefer, our NTP
Servers are calibrated primarily for this part of the host time
The driftfile format is as follows: Driftfile filename
The time spent in contacting the superior time server, recorded in the file following the Driftfile parameter: driftfile
Subsequent files need to use the full path file name, cannot be linked to the file, and the permissions of the file need to be set to NTPD daemon can write.
Vi/etc/ntp.conf
1. Clients that allow any IP can have time synchronization
Modify the line "restrict default Kod nomodify notrap nopeer noquery" to:
Restrict default nomodify
2. Allow time synchronization only for clients with 192.168.0.0 network segments
Restrict 192.168.0.0 mask 255.255.0.0 nomodify
Source file installation is no ntp.conf (idle trouble, you can choose Yum-y Install NTP) manually add, touch/etc/ntp.conf, copy the following
======================================================================
Restrict default nomodify notrap noquery
Restrict 127.0.0.1
Restrict 192.168.0.0 mask 255.255.0.0 nomodify
Server 0.pool.ntp.org
Server 1.pool.ntp.org
Server 2.pool.ntp.org
Server 127.127.1.0 # Local clock
Fudge 127.127.1.0 stratum #调整为8 that will use local time as an NTP service for NTP clients
Driftfile/var/lib/ntp/drift
Broadcastdelay 0.008
Keys/etc/ntp/keys
=====================================================================
Synchronize the server time with the time.nist.gov time to make the server a standard time
Use NTPD sync Time (note: When using NTPD, the time difference between this machine and the source can not be too large, otherwise not run, so should
First use Ntpdate to obtain time initial value after starting NTPD)
[Root@localhost ~]# ntpdate time.nist.gov
Start ntpd with daemon
[Root@localhost ~]#/usr/local/ntp/bin/ntpd-c/etc/ntp.conf-p/tmp/ntpd.pid
If it is yum install NTP using chkconfig--level ntpd on
[root@localhost ~] #netstat-nul |grep 123
UDP 0 0 192.168.50.91:123 0.0.0.0:*
UDP 0 0 127.0.0.1:123 0.0.0.0:*
UDP 0 0 0.0.0.0:123 0.0.0.0:*
[Root@localhost ~]# Ntpq-p
Remote refID St T when poll reach delay offset jitter
==============================================================================
114.80.81.1 204.152.184.72 2 U 5 64 1 13.142-287655 0.001
218.75.4.130 216.218.192.202 2 U 4 64 1 15.109-287655 0.001
*local (0). Locl. Ten L 3 64 1 0.000 0.000 0.001
Remote: The name of the NTP server that responds to this request.
The REFID:NTP NTP server used by the server.
St:remote the level of the remote server. Because NTP is a layered structure, there are top servers, multi-layer relay server to the client. So the server can be set to 1-16 from high to low. To slow down load and network congestion, in principle, avoid direct connection to level 1 The server
When: The number of seconds since the last successful request.
Poll: How much time does the local machine and the remote server synchronize (in seconds). At the beginning of the NTP, the poll value will be relatively small, and the frequency of synchronization with the server will increase, you can adjust to the correct time range, and then poll value will gradually increase, synchronization The frequency will be correspondingly reduced
Reach: This is a octal value that is used to test whether it can connect to the server. The value of each successful connection increases.
Delay: Send sync from local machine request to round trip time on NTP server
Offset: The time offset, in milliseconds (ms), that the host synchronizes with the synchronized time source through the NTP clock. The closer the offset is to 0, the closer the host and NTP server are