NTP server Construction
NTP is a time server that provides the Synchronization Update time of other computers, so that the time of each computer is the same, without any deviation due to the long running of the system. The client also needs to install the NTP service.
1. Install NTP,
[[Email protected] ~] # Yum-y install NTP
2. Modify the master configuration file. By default, all users are rejected for synchronization. Add a rule to allow synchronization of 192.168.10.0 network segments.
[[Email protected] ~] # Vim/etc/NTP. conf [[Email protected] ~~] # Grep-ve "^ # | ^ $"/etc/NTP. conf Driftfile/var/lib/NTP/drift // The frequency error of the Upper-layer NTP server is recorded in this file Restrict default Kod nomodify notrap nopeer noquery // disable all Address Synchronization times, modify, View Restrict-6 default Kod nomodify notrap nopeer noquery // disable synchronization time of all IPv6 addresses, modify, View Restrict 192.168.100.0 mask 255.255.255.0 nomodify // Add the allowed 192.168.100.0 network segment synchronization time Restrict 127.0.0.1 Restrict-6: 1 Server 0.rhel.pool.ntp.org // specifies the NTP server for time verification. The priority is from top to bottom. Server 1.rhel.pool.ntp.org Server 2.rhel.pool.ntp.org Includefile/etc/NTP/crypto/PW Keys/etc/NTP/keys |
3. Start the service
[[Email protected] ~] # Service ntpd restart [[Email protected] ~] # Chkconfig ntpd on
|
4. Verification
Server Port
[[Email protected] ~] # Netstat-Aun | grep: 123 UDP 0 0 192.168.10.254: 123
|
Client
Ntpdate 192.168.10.254 synchronization between customers and servers |
5. automatically update and add to the scheduled task.
[[Email protected] ~] # Crontab-e 0 10 ***/sbin/ntpdate 192.168.10.254 0 10 ***/sbin/hwclock -- systohc [[Email protected] ~] # Service crond restart [[Email protected] ~] # Chkconfig crond on
|
Ntpstat displays the strong state of the NTP server
Enable standard NTP query for NTQ
Ntpdate indicates the server for immediate update
Note: manual update of ntpdate and automatic update of NTP service cannot be used at the same time