DNS配置
dns resolve
dns server 223.5.5.5
时间配置
手动配置
用户视图
设置时区
clock timezone Beijing add 08:00:00
设置时间,例如:2023年12月23日12:00:00
clock datetime 12:00:00 2023-12-23
显示当前时间
display time all
自动同步
系统视图
开启ntp
服务
undo ntp-service server disable
设置时区
clock timezone Beijing add 08:00:00
设置同步地址
ntp-service unicast-server 120.25.115.20
交换机作为服务器
服务端
使能NTP服务器功能
undo ntp server disable
配置时间层数
ntp refclock-master 1
开启认证(下列步骤可选)
[SwitchA] ntp authentication enable
[SwitchA] ntp authentication-keyid 45 authentication-mode hmac-sha256 hello123456
//认证算法有MD5和HMAC-SHA256两种,HMAC-SHA256安全性高,MD5运行速度块。本举例使用HMAC-SHA256。
[SwitchA] ntp trusted authentication-keyid 45
指定侦听接口
ntp server source-interface vlanif ID
客户端
设置同步地址
undo ntp server disable
ntp-service unicast-server IP
开启认证情况
[SwitchB] ntp authentication enable
[SwitchB] ntp authentication-keyid 45 authentication-mode hmac-sha256 hello123456
//认证算法有MD5和HMAC-SHA256两种,HMAC-SHA256安全性高,MD5运行速度块。本举例使用HMAC-SHA256。
[SwitchB] ntp trusted authentication-keyid 45
[SwitchB] ntp unicast-server 10.10.1.1 authentication-keyid 45
//配置时间同步的方式为单播客户端/服务器模式。