4-1·NTP服務器配置搭建

一·NTP服務器搭建

1)安裝NTP服務

[root@localhost ~]# yum -y install ntp
[root@localhost ~]# vim /etc/ntp.conf 
restrict 172.25.0.0 mask 255.255.255.0 nomodify notrap          //添加接受的地址範圍
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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
server s1a.time.edu.cn iburst                                   //中國郵電大學NTP服務器
[root@localhost ~]# systemctl start ntpd
[root@localhost ~]# systemctl enable ntpd

2)防火牆開啓端口,NTP默認端口號UDP123

[root@localhost ~]# firewall-cmd --add-service=ntp --permanent         //永久生效放行ntp服務
[root@localhost ~]# firewall-cmd --reload                      //重讀防火牆

3)查看同步

[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.112.202.in-a 202.118.1.46     2 u    9   64    1   93.632    9.389   5.115

4)配置ntp客戶端

[root@localhost ~]# yum -y install ntpdate                     //安裝客戶端軟件
[root@localhost ~]# ntpdate s1a.time.edu.cn                        //指定服務器域名
[root@localhost ~]# systemctl restart ntpdate                      //重啓服務
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章