CentOS 6搭建局域网NTP服务器

CentOS 6搭建局域网NTP服务器

 

#########服务器:#########

一、时间服务器端配置

修改配置文件vi /etc/ntp.conf

   

1、客户端选择

1)允许任何客户端

restrict default nomodify

2)允许特定客户端

restrict 192.168.18.0 mask 255.255.255.0 nomodify

server 192.168.0.84

*二选一

   

2、指定时间服务器

1)指定特定时间服务器,注释掉默认server服务器

server time-b.nist.gov

2)开启本地时间服务器,上述外网time-b.nist.gov失效时,内网充当时间服务器。

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10

3、重启时间服务

service ntpd restart

4、根据实际需求设置防火墙端口

udp 123

#########客户端#########

一、linux客户端

1、linux客户端修改配置文件,注释掉其它时间服务器,指定内网时间服务器,重启ok。

vim /etc/ntp.conf

server x.x.x.x

2、客户端校验

ntpq -p查询上级时间服务器

ntpstat 查询状态

ntpdate

猜你喜欢

转载自blog.csdn.net/gong_xucheng/article/details/78294374