1腌且、服務(wù)端
1.1 安裝ntp服務(wù)
yum -y install ntp
1.2 修改配置文件
vi /etc/ntp.conf
添加如下內(nèi)容
# 將這行給注釋
#restrict default nomodify notrap nopeer noquery
# 然后添加這兩行 恶耽,意思是 允許IPV4 IPV6 查詢 拒絕修改
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
# 添加修改上層時(shí)間服務(wù)器驶兜,如果能聯(lián)通外網(wǎng)聂儒,則不需要修改灼擂,
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst
# 如果聯(lián)不通外網(wǎng)嫉入,則把上面幾行注釋焰盗,然后添加下面兩行,意思是設(shè)置成時(shí)間服務(wù)器是自己
server 127.127.1.0
fudge 127.127.1.0 stratum 10
1.3 啟動(dòng)服務(wù)并開機(jī)啟動(dòng)
systemctl start ntpd && systemctl enable ntpd
2咒林、客戶端
2.1 安裝ntp服務(wù)
yum -y install ntp
2.2 修改配置文件
vi /etc/ntp.conf
添加如下內(nèi)容
# IP為NTP 服務(wù)端IP
server 192.168.10.20 iburst
2.3 啟動(dòng)服務(wù)并開機(jī)啟動(dòng)
systemctl start ntpd && systemctl enable ntpd