公司的一台服务器硬件坏了挂了,其中就有ntp服务端,写一下ntp服务端的简单配置。

1、首先安装ntp,centos 系统执行 yum install ntp

2、写入配置文件/etc/ntp.conf如下

restrict 192.168.18.153 mask 255.255.255.0 nomodify notrap

restrict 192.168.18.0 mask 255.255.255.0 nomodify

server time.pool.aliyun.com

#server 127.127.1.0


server用的是阿里云的ntp服务器。

3、首次配置服务器需要一定的时间去server同步时间,执行ntpq -p查看是否同步成功


4、同步成功之后,同一个内网的就可以执行ntpdate 192.168.18.153来同步时间