1. Confirm NTP Package: # yum install ntp 2, configure time source # vi /etc/ntp.conf server pool.ntp.org #可选择其他优先服务器server 2.cn.pool.ntp.orgserver 1.asia.pool.ntp.orgserver 2.asia.pool.ntp.org # allows the upper-level time server to proactively modify the native time restrict 2.cn.pool.ntp.org nomodify Notrap noqueryrestrict 1.asia.pool.ntp.org nomodify notrap noqueryrestrict 2. asia.pool.ntp.org nomodify notrap noqueryserver 127.0.0.1 # local Clockfudge 127.0.0.1 stratum 10 3, configure whether to provide time service for other PCs # vi /etc/ntp.conf Restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 4, configuring the auto-run time service at boot # chkconfig ntpd on 5, start or stop time service # service ntpd start # service ntpd stop # service ntpd restart 6, verify that the NTP service is running # pgrep ntpd 7, initial synchronization # ntpdate -u time.lib.tsinghua.edu.cn 8, confirm the synchronization success # ntpq -p 9, and suggest to modify /etc/sysconfig/ntpd Files # vi /etc/sysconfig/ntpd SYNC_HWCLOCK=yes # Change to yes ! So the host BIOS time will be changed along with the same! of course, if you want to provide a time service, you must also set the configuration of the iptable firewall accordingly. The CentOS Time service uses the udp 123 port.
For more information, please contact Ding Feng Hu Jiashong
tel.18824258907
qq.2881064155
Time synchronization using NTP in CentOS 7