Linux(Unix)时钟同步ntpd服务配置方法

来源:互联网 发布:c语言开发工具 编辑:程序博客网 时间:2024/05/22 11:30
 

Linux(Unix)时钟同步ntpd服务配置方法

1057人阅读 评论(0)收藏 举报

假定时钟服务器IP地址为:192.168.0.1

服务器端配置:

1:置/etc/ntp.conf文件内容为:

server 127.127.1.0 minpoll 4
fudge 127.127.1.0 stratum 1
restrict 127.0.0.1
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
driftfile /var/lib/ntp/drift

2: /etc/ntp/ntpservers应置空
3: /etc/ntp/step-tickers应配置为 127.127.1.0 

上诉修改完成后,以root用户身份重启ntpd服务:service ntpd restart即可

客户端配置:

1:置/etc/ntp.conf文件内容为:

server 192.168.0.1
fudge 127.127.1.0 stratum 2
restrict 127.0.0.1
driftfile /var/lib/ntp/drift
restrict 192.168.0.1 mask 255.255.255.255

2. /etc/ntp/ntpservers 文件内容置空
3. /etc/ntp/step-tickers文件内容置为时钟服务器IP地址 192.168.0.111

上诉修改完成后,以root用户身份重启ntpd服务:service ntpd restart即可

用户可用以下两个常用命令查看ntpd服务状态:

1 ntpq -p

2 ntpstat