主节点:
打开vim /etc/ntp.conf文件
1 For more information about this file, see the man pages 2 # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). 3 4 driftfile /var/lib/ntp/drift 5 6 # Permit time synchronization with our time source, but do not 7 # permit the source to query or modify the service on this system. 8 restrict default kod nomodify notrap nopeer noquery 9 #restrict -6 default kod nomodify notrap nopeer noquery 10 11 # Permit all access over the loopback interface. This could 12 # be tightened as well, but to do so would effect some of 13 # the administrative functions. 14 restrict 192.168.133.131 nomodify notrap nopeer noquery #该节点的IP地址 15 restrict 127.0.0.1 16 restrict -6 ::1 17 18 # Hosts on local network are less restricted. 19 restrict 192.168.133.2 mask 255.255.255.0 nomodify notrap #网关和子网掩码 20 21 # Use public servers from the pool.ntp.org project. 22 # Please consider joining the pool (http://www.pool.ntp.org/join.html). 23 #server 0.rhel.pool.ntp.org iburst 24 57 lines yanked 25 26 server 127.127.1.0 27 fudge 127.127.1.0 stratum 8
从节点
vim vim /etc/ntp.conf
1 # For more information about this file, see the man pages 2 # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). 3 4 driftfile /var/lib/ntp/drift 5 6 # Permit time synchronization with our time source, but do not 7 # permit the source to query or modify the service on this system. 8 restrict default nomodify notrap nopeer noquery 9 #restrict -6 default kod nomodify notrap nopeer noquery 10 11 # Permit all access over the loopback interface. This could 12 # be tightened as well, but to do so would effect some of 13 # the administrative functions. 14 15 restrict 192.168.133.129 nomodify notrap nopeer noquery#该节点IP地址 16 restrict 127.0.0.1 17 restrict -6 ::1 18 19 # Hosts on local network are less restricted. 20 restrict 192.168.133.2 mask 255.255.255.0 nomodify notrap 21 22 23 24 #server 2.rhel.pool.ntp.org iburst 25 #server 3.rhel.pool.ntp.org iburst 26 server 192.168.133.136 #主机IP地址 27 fudge 192.168.133.136 stratum 8