大家好,我是沈工,一位喜欢结交朋友的资深通信技术爱好者,同时也是业内人士!
- Let‘s Go-
接上期:【数通】| LINUX时钟服务搭建及数通设备时钟同步设置-Centos搭建时钟服务器①


[root@localhost /]# ntpdate -u 192.168.2.43 2 Apr 16:03:37 ntpdate[44230]: adjust time server 192.168.2.43 offset -0.000051 sec<Huawei>undo terminal monitor Info: Current terminal monitor is off. <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]vlan 254 // [Huawei-vlan254]quit [Huawei]interface Vlanif 254 [Huawei-Vlanif254]ip address 192.168.2.42 24 //配置vlan254和IP地址等相关后,可与时钟服务器端互通 [Huawei-Vlanif254]quit [Huawei]interface GigabitEthernet 0/0/1 [Huawei-GigabitEthernet0/0/1]port link-type access [Huawei-GigabitEthernet0/0/1]port default vlan 254 [Huawei-GigabitEthernet0/0/1]quit [Huawei]quit <Huawei>clock timezone Beijing add 08:00:00 //配置设备时区为北京时区(UTC+8 东八时区) <Huawei>system-view Enter system view, return user view with Ctrl+Z. [Huawei]ntp-service authentication enable //开启 NTP 认证功能 [Huawei]ntp-service authentication-keyid 8 authentication-mode md5 admin123456 //配置 NTP 认证密钥,指定密钥ID为8,使用md5算法作为认证模式 [Huawei]ntp-service reliable authentication-keyid 8 //声明密钥 ID 为 1 的认证密钥是可信的,在启用认证后,只有被标记为reliable的密钥才能用于与 NTP 服务器的身份验证,防止使用未授权的密钥进行通信。 [Huawei]ntp-service unicast-server 192.168.2.43 authentication-keyid 8 preference //配置单播 NTP 服务器,指定NTP服务器地址:192.168.2.43,authentication-keyid 8:使用密钥ID 8 与该服务器进行认证,preference:将该服务器设置为首选时间源,当存在多个 NTP 服务器时,交换机优先选择它进行时间同步。 [Huawei]ntp-service sync-interval 600 //设置 NTP 同步间隔为 600 秒(10 分钟), 交换机每 10 分钟主动向 NTP 服务器请求一次时间同步,确保设备时间与服务器保持一致。 [Huawei]quit <Huawei>save <Huawei>display ntp-service status clock status: synchronized //时钟已同步 clock stratum: 9 //时钟层级较时钟服务器端高1级属于正常情况 reference clock ID: 192.168.2.43 //时钟服务器端IP地址 nominal frequency: 64.0000 Hz actual frequency: 64.0000 Hz clock precision: 2^11 clock offset: 0.0000 ms root delay: 24.34 ms root dispersion: 0.39 ms peer dispersion: 0.49 ms reference time: 07:06:54.268 UTC Apr 3 2026(ED79E58E.44A66559) synchronization state: clock set //同步状态:设置时钟通用建议与注意事项(官方引用)
物理层时钟同步(频率/相位同步):适用于对时钟精度要求高的场景(如运营商网络、5G前传等),需注意以下事项:
