1、安装ntp包
2、修改/etc/ntp.conf文件,内容如下
1 | # Use public servers from the pool.ntp.org project. |
2 | # Please consider joining the pool (http://www.pool.ntp.org/join.html). |
3 | #server 0.centos.pool.ntp.org |
4 | #server 1.centos.pool.ntp.org |
5 | #server 2.centos.pool.ntp.org |
首先注释掉上层server代码,
1 | # Undisciplined Local Clock. This is a fake driver intended for backup |
2 | # and when no outside source of synchronized time is available. |
3 | server 127.127.1.0 # local clock |
4 | fudge 127.127.1.0 stratum 0 |
1 | restrict 192.168.56.0 mask 255.255.255.0 nomodify notrap |
3、
1 | service ntpd restart |
4、注意iptables
upd 123端口
5、等待ntp服务器和本地时间同步,这需要一些时间
出现这个时,表示ntp server可以对外提供服务了。
如果没有与本地同步成功,则出现如下图