Configure NTP time synchronization on Linux with a break operation step, sorted as follows:
1. Install packages (on server and client):
The code is as follows |
Copy Code |
Yum Install NTP |
2. Server-side configuration
For example:
First, the server IP address is set to: 192.168.146.110
Modifying the NTP configuration file
The code is as follows |
Copy Code |
Vim/etc/ntp.conf Server 0.redhat.pool.ntp.org//set up Superior servers Restrict 192.168.146.0 mask 255.255.255.0 nomodify//Set which client machines can be synchronized with the NTP server Manually correct one time before starting the NTP service Ntpdate 0.redhat.pool.ntp.org Service NTPD Restart Chkconfig ntpd on View NTP service status Netstat-ln | grep 123 Ntpstat |
3. Client Configuration:
The code is as follows |
Copy Code |
Ntpdate 192.168.146.110//sync time with NTP server |
or synchronize periodically
code is as follows |
copy code |
crontab -E */5 * * * */usr/sbin/ntpdate -u 192.168.146.110 //sync every five minutes restart Cron D Service/etc/init.d/crond Restart ntpq-p//view sync status |