天天看点

linux下ntp时间服务器配置及客户端注意事项

折腾了半天,里标记一下,以备后用。

一、同步环境

1、ntp客户端:windows7,关闭了防火墙,ip:192.168.1.101

2、ntp服务端:windows7下虚拟机redhat5.5,关闭了防火墙+selinux,ip:192.168.1.105

二、ntp服务端步骤:

1、cd /etc  && cp ntp.conf ntp.bak.conf

2、vi ntp.conf  

(1)找到restrict开始的部分,删除之,改为以下三行:

restrict default kod nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict 192.168.1.0 mask 255.255.255.0 nomodify

(2)找到:

# use public servers from the pool.ntp.org project.

# please consider joining the pool (http://www.pool.ntp.org/join.html).

添加以下3条ntp时间服务器

server s1b.time.edu.cn

server s1a.time.edu.cn

server 210.72.145.44

参考:国内常用ntp服务器地址及ip:http://www.douban.com/note/171309770/

保存ntp.conf,执行:service ntpd restart

三、windows客户端操作

1、客户端“开始”,搜索里输入gpedit.msc,然后回车

linux下ntp时间服务器配置及客户端注意事项

图1

打开如下窗口:

linux下ntp时间服务器配置及客户端注意事项

图2

2、单击“配置windows ntp客户端”,在打开的窗口里,选择“启用”,然后修改下面的选项框:ntpserver:192.168.1.105(也就是服务端ip),类型:ntp,然后保存。

linux下ntp时间服务器配置及客户端注意事项

图3

3、回到图2对话框,单击“启用windows ntp客户端”,如果选项框是空白,点击右上方的“上一个配置”。

linux下ntp时间服务器配置及客户端注意事项

图4

然后,可以看到下图5,单击“确定”保存。

linux下ntp时间服务器配置及客户端注意事项

4、把客户端时间与服务端时间修改误差大一些,测试的时候可以更好的看到效果。

     双击任务栏最右边的时间,打开“日期和时间”,切换到“internet时间”-“更改设置”,在服务器一栏里输入:192.168.1.105,然后“立即更新”,不出意外的话,接着会看到更新成功的提示。

继续阅读