CentOS7.6下ntp服务器搭建


NTP服务器用的端口号是TCP/UDP的123端口,这里只考虑内网的时间同步,不做认证,任何客户端都能到服务器上来同步时间,我们一共需要操作的是2个关键点,谁能到我这里来同步时间,我的时间又和谁同步,搭建步骤如下:

1、安装ntp和ntpdate
yum -y install ntp ntpdate

2、编辑配置文件
vim /etc/ntp.conf
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 把这个#号这行复制以后,这一行的作用是指定谁能够到我这里来同步时间的,通常我只需要改这一个就行了
restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap
#下面是默认的上游时间服务器,如果无法上网,你可以指定其他内网机器IP
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

3、客户端验证
[root@localhost ~]# ntpdate 192.168.100.24
4 May 15:24:21 ntpdate[1563]: adjust time server 192.168.100.24 offset 0.017559 sec


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM