NTP (Net Time Protocal)配置
通过配置NTP,能够获取上一级Server的时间,并校准,且也可自身作为NTP服务器为其它NTP客户端服务。
1
1.1 Client
通过配置NTP,能够获取上一级Server的时间,并校准
1.1.1 拓扑
1.1.2 配置
1)配置好管理口IP,默认网关(保证管理口能通外网),配置前查看当前时间:
配置NTP:
xNet#configure terminal
xNet(config)#ntp server 132.163.4.101
2)等待几分钟(4次交互之后时间才会再次同步,报文间隔是64秒,主要是避免client过于敏感,以及安全等相关因素),交换机时间同步为来自时钟源(132.163.4.101)服务器的时间。
3)查看时间是否同步
xNet#show ntp status
4)查看当前时间
1.1.3 结果
通过配置NTP,能够获取上一级Server的时间,并校准。
1.2 Server
交换机自身作为NTP服务器为其它NTP客户端服务。
1.2.1 拓扑
1.2.2 配置
1)配置相应服务器配置:
xNet#configure terminal
xNet(config)#ntp master 2
xNet(config)#end
xNet#
2)配置authentication功能
xNet#configure terminal
xNet(config)#ntp authentication-key 1 md5 xNet
xNet(config)#ntp trusted-key 1
xNet(config)#ntp authenticate
xNet(config)#end
xNet#
3)利用PC-202机通过NTP Client来获取交换机207的时间:
PC-202初始时间:
PC-202使用ntpdate同步时间,需要认证值:
/etc/ntp/keys文件格式:
|
Key number |
MD5 authentication |
Authentication key |
|
1 |
M |
xNet |
|
2 |
M |
xNet |
例如:
a)认证错误
root@xNet-weil:~# ntpdate -d -a 2 -k /etc/ntp/keys 10.204.253.207
-d 打开debug信息
-a key
-k keyfile
显示Server is untrusted,认证失败。
b)认证成功
root@xNet-weil:~# ntpdate -d -a 1 -k /etc/ntp/keys 10.204.253.207
1.2.3 结果
交换机自身作为NTP服务器能够为其它NTP客户端服务,并有认证功能。

浙公网安备 33010602011771号