配置普通NTP组播模式示例
在组播域中,指定时钟精度高的设备作为NTP服务器,其他的设备同步服务器的时钟。
组网需求
如图5-6所示。
DeviceC和DeviceD在同一个网段,DeviceA在另一个网段。DeviceF连接这两个网段。
DeviceC作为NTP组播服务器,使用本地时钟作为NTP主时钟,层数为2,从接口GE0/1/0发送组播消息包。
DeviceD和DeviceA分别从各自的接口GE0/1/0侦听组播消息。
本例中interface1和interface2分别代表GE0/1/0和0/2/0。
操作步骤
- 配置各路由器的IP地址
按图5-6配置各接口的IP地址。具体过程略。
- 配置NTP组播服务器
# 配置DeviceC使用本地时钟作为NTP主时钟,层数为2。
<DeviceC> system-view [~DeviceC] ntp-service refclock-master 2
# 配置DeviceC为NTP组播服务器,从接口GE0/1/0发送NTP组播消息包。
[*DeviceC] interface gigabitethernet 0/1/0 [*DeviceC-GigabitEthernet0/1/0] ntp-service multicast-server [*DeviceC-GigabitEthernet0/1/0] commit
- 配置与服务器在同一网段的NTP组播客户端DeviceD
# 配置DeviceD为NTP组播客户端,从接口GE0/1/0侦听NTP组播消息包。
<DeviceD> system-view [~DeviceD] interface gigabitethernet 0/1/0 [~DeviceD-GigabitEthernet0/1/0] ntp-service multicast-client [*DeviceD-GigabitEthernet0/1/0] commit
- 配置与服务器在不同网段的NTP组播客户端DeviceA
# 配置DeviceA为NTP组播客户端,从接口GE0/1/0侦听NTP组播消息包。
<DeviceA> system-view [~DeviceA] interface gigabitethernet 0/1/0 [~DeviceA-GigabitEthernet0/1/0] ntp-service multicast-client [*DeviceA-GigabitEthernet0/1/0] commit
- 使能DeviceF组播功能
<DeviceF> system-view [~DeviceF] multicast routing-enable [*DeviceF] commit [~DeviceF] interface gigabitethernet 0/1/0 [~DeviceF-GigabitEthernet0/1/0] pim sim [~DeviceF-GigabitEthernet0/1/0] igmp enable [~DeviceF-GigabitEthernet0/1/0] igmp static-group 224.0.1.1 [*DeviceF-GigabitEthernet0/1/0] commit [~DeviceF-GigabitEthernet0/1/0] quit [~DeviceF] interface gigabitethernet 0/2/0 [~DeviceF-GigabitEthernet0/2/0] pim sim [~DeviceF-GigabitEthernet0/2/0] quit
- 验证配置结果
完成以上配置后,DeviceD能够同步到DeviceC,而DeviceA不能同步到DeviceC。
这是因为DeviceA和DeviceC不在同一个网段,收不到DeviceC发出的组播包。
查看DeviceD的NTP状态,可以看到时钟状态为“synchronized”,即,已经完成同步。时钟的层数为3,比服务器DeviceC低1级。
[~DeviceD] display ntp-service status clock status: synchronized clock stratum: 3 reference clock ID: 3.0.1.31 nominal frequency: 60.0002 Hz actual frequency: 60.0002 Hz clock precision: 2^18 clock offset: 0.66 ms root delay: 24.47 ms root dispersion: 208.39 ms peer dispersion: 9.63 ms reference time: 17:03:32.022 UTC Apr 25 2005(C61734FD.800303C0) synchronization state: clock synchronized
配置文件
DeviceA的配置文件
# sysname DeviceA # interface GigabitEthernet0/1/0 undo shutdown ip address 1.0.1.11 255.255.255.0 ntp-service multicast-client # return
DeviceC的配置文件
# sysname DeviceC # ntp-service refclock-master 2 # interface GigabitEthernet0/1/0 undo shutdown ip address 3.0.1.31 255.255.255.0 ntp-service multicast-server # return
DeviceD的配置文件
# sysname DeviceD # interface GigabitEthernet0/1/0 undo shutdown ip address 3.0.1.32 255.255.255.0 ntp-service multicast-client # Return
DeviceF的配置文件
# sysname DeviceF # multicast routing-enable # interface GigabitEthernet0/1/0 undo shutdown ip address 1.0.1.2 255.255.255.0 pim sm # interface GigabitEthernet0/2/0 undo shutdown ip address 3.0.1.2 255.255.255.0 pim sm igmp static-group 224.0.1.1 # Return