把华为交换机设置成时钟源服务器(NTP),提供给下面客户端 Linux 服务器使用,
1,先设置交换机的时区,和正确时间
# 假设地理位置在中国北京,设置本地时区名称为 BJ。
如果系统默认的 UTC 是伦敦时间,伦敦当地时间为 2012 年 12 月 1 日 0 时 0 分 0 秒,想要得到对应的北京时间的方法是:北京处于+8 时区,时间偏移量增加了 8。在配置时,就是在系统默认的 UTC 时区的基础上,加上偏移量 8,才能得到预期的 BJ 时区。
<HUAWEI> clock timezone BJ add 08:00:00
设置时区并在现在的 UTC 基础上偏移 8
<HUAWEI> clock datetime 0:0:0 2012-12-01
这是设置时间的命令,设置成对应的北京时间就行。
2,开启交换机的 NTP 服务
# 使能 NTP 服务器功能。
[~HUAWEI] undo ntp server disable 开启 NTP 服务(默认关闭)
[*HUAWEI] commit
# 配置 NTP 主时钟,层数为 2。
[~HUAWEI] ntp refclock-master 2
[*HUAWEI] commit
3,下面的是 NTP 设置的更多功能,可以不配置
# 配置 NTP 认证功能,配置认证密钥并声明该密钥可信。
[~HUAWEI] ntp authentication enable
[*HUAWEI] ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
[*HUAWEI] ntp trusted authentication-keyid 42
[*HUAWEI] commit
- 广播模式
# 配置 NTP 主时钟,层数为 2。
<HUAWEI> system-view
[~HUAWEI] ntp refclock-master 2
[*HUAWEI] commit
# 配置 NTP 认证功能,配置认证密钥并声明该密钥可信。
[~HUAWEI] ntp authentication enable
[*HUAWEI] ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
[*HUAWEI] ntp trusted authentication-keyid 42
[*HUAWEI] commit
# 配置 NTP 广播服务器,从接口 10GE1/0/1 发送 NTP 广播报文,并指定使用密钥 ID 42 加密。
[~HUAWEI] interface 10ge 1/0/1
[~HUAWEI-10GE1/0/1] undo portswitch
[*HUAWEI-10GE1/0/1] ntp broadcast-server authentication-keyid 42
[*HUAWEI-10GE1/0/1] quit
[*HUAWEI] commit
# 使能 NTP 服务器功能。
[~HUAWEI] undo ntp server disable
[*HUAWEI] commit
- 组播模式
# 配置 NTP 主时钟,层数为 2。
<HUAWEI> system-view
[~HUAWEI] ntp refclock-master 2
[*HUAWEI] commit
# 配置 NTP 认证功能,配置认证密钥并声明该密钥可信。
[~HUAWEI] ntp authentication enable
[*HUAWEI] ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
[*HUAWEI] ntp trusted authentication-keyid 42
[*HUAWEI] commit
# 配置 NTP 组播服务器,从接口 10GE1/0/1 发送 NTP 组播报文,并指定使用密钥 ID 42 加密。
[~HUAWEI] interface 10ge 1/0/1
[~HUAWEI-10GE1/0/1] undo portswitch
[*HUAWEI-10GE1/0/1] ntp multicast-server authentication-keyid 42
[*HUAWEI-10GE1/0/1] quit
[*HUAWEI] commit
# 使能 NTP 服务器功能。
[~HUAWEI] undo ntp server disable
[*HUAWEI] commit
- 多播模式
# 配置 NTP 主时钟,层数为 2。
<HUAWEI> system-view
[~HUAWEI] ntp refclock-master 2
[*HUAWEI] commit
# 配置 NTP 认证功能,配置认证密钥并声明该密钥可信。
[~HUAWEI] ntp authentication enable
[*HUAWEI] ntp authentication-keyid 42 authentication-mode hmac-sha256 Hello@123456
[*HUAWEI] ntp trusted authentication-keyid 42
[*HUAWEI] commit
# 配置 NTP 多播服务器,从接口 10GE1/0/1 发送 NTP 多播报文。
[~HUAWEI] interface 10ge 1/0/1
[~HUAWEI-10GE1/0/1] undo portswitch
[*HUAWEI-10GE1/0/1] ntp manycast-server
[*HUAWEI-10GE1/0/1] quit
[*HUAWEI] commit
# 使能 NTP 服务器功能。
[~HUAWEI] undo ntp server disable
[*HUAWEI] commit
原文始发于:Pipci
相关文章
- ThinkPad x13 Gen1傲腾H10重装系统的麻烦(0)
- Win10系统电脑进入安全模式的四种方法,让你轻松应对各种问题(0)
- 使用Jetson_benchmark进行性能测试(0)
- 【Python】修改Windows中 pip 的缓存位置与删除 pip 缓存(1)
- ‘%s=%s’ % (k, v) for k, v in params.items(), ^ SyntaxError: Generator expression must be parent(0)