华为交换机NTP时间同步设置(客户端和服务端)

作为NTP客户端(时间同步)

# 设置时区
clock timezone BeiJing add 08:00:00
# clock timezone BJ add 08:00:00

# 设置NTP服务器地址
ntp-service unicast-server 10.10.10.250 #将此处IP更改为时钟服务器地址

# 查看当前时间
display clock
# 23:32:42  2019/09/10
# 2021-09-28 23:32:42
# Tuesday
# Time Zone : Beijing add 08:00:00

# 查看NTP服务会话
display ntp-service sessions

# 提交所有的修改并保存
commit
re
sa

作为NTP服务端(提供时间同步服务器)

# 设置时间的命令如下:
# clock datetime 0:0:0 2012-12-01

# 开启交换机的NTP服务
undo ntp server disable  # 默认关闭
# 配置NTP主时钟,层数为2
ntp refclock-master 2

# 下面的是NTP设置的更多功能,可以不配置
#  配置NTP认证功能,配置认证密钥并声明该密钥可信
ntp authentication enable
ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
ntp trusted authentication-keyid 42
# 广播模式
# 配置NTP广播服务器,从接口10GE1/0/1发送NTP广播报文,并指定使用密钥ID 42加密。
interface 10ge 1/0/1
undo portswitch
ntp broadcast-server authentication-keyid 42
# 组播模式
interface 10ge 1/0/1
undo portswitch
ntp multicast-server authentication-keyid 42
# 多播模式
interface 10ge 1/0/1
undo portswitch
ntp manycast-server

# 提交所有的修改并保存
commit
re
sa