In Figure 1, SwitchA, SwitchB, and SwitchC are located within the same LAN. SwitchC synchronizes its clock with GPS through radio.
To ensure accounting accuracy, all switches on the LAN require clock synchronization with the clock of SwitchC.
The configuration roadmap is as follows:
Configure SwitchC as the master clock server, use its local clock as the NTP master clock, and set the clock stratum to 2.
Configure SwitchC as the NTP multicast server that sends multicast packets through VLANIF 10 (the corresponding physical interface is GE0/0/1).
Configure SwitchA and SwitchB as NTP multicast clients. Configure SwitchA to listen to multicast packets on VLANIF 10 (the corresponding physical interface is GE0/0/2). Configure SwitchB to listen to multicast packets on VLANIF 10 (the corresponding physical interface is GE0/0/1).
# Configure an IP address on SwitchB. The configurations of SwitchC and SwitchA are similar to the configuration of SwitchB, and are not mentioned here. For details, see the configuration files.
<HUAWEI> system-view [HUAWEI] sysname SwitchB [SwitchB] vlan 10 [SwitchB-vlan10] quit [SwitchB] interface gigabitethernet 0/0/1 [SwitchB-GigabitEthernet0/0/1] port link-type hybrid [SwitchB-GigabitEthernet0/0/1] port hybrid pvid vlan 10 [SwitchB-GigabitEthernet0/0/1] port hybrid untagged vlan 10 [SwitchB-GigabitEthernet0/0/1] quit [SwitchB] interface vlanif 10 [SwitchB-Vlanif10] ip address 10.1.1.1 24 [SwitchB-Vlanif10] quit
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan 10 [Switch-vlan10] quit [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type hybrid [Switch-GigabitEthernet0/0/1] port hybrid untagged vlan 10 [Switch-GigabitEthernet0/0/1] port hybrid pvid vlan 10 [Switch-GigabitEthernet0/0/1] quit [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] port link-type hybrid [Switch-GigabitEthernet0/0/2] port hybrid untagged vlan 10 [Switch-GigabitEthernet0/0/2] port hybrid pvid vlan 10 [Switch-GigabitEthernet0/0/2] quit [Switch] interface gigabitethernet 0/0/3 [Switch-GigabitEthernet0/0/3] port link-type hybrid [Switch-GigabitEthernet0/0/3] port hybrid untagged vlan 10 [Switch-GigabitEthernet0/0/3] port hybrid pvid vlan 10 [Switch-GigabitEthernet0/0/3] quit
# Configure the local clock of SwitchC as the NTP master clock, and set the clock stratum to 2.
[SwitchC] ntp-service refclock-master 2
# Configure SwitchC as the NTP multicast server that sends NTP multicast packets through VLANIF 10.
[SwitchC] interface vlanif 10 [SwitchC-Vlanif10] ntp-service multicast-server [SwitchC-Vlanif10] quit
# Enable the NTP server function on SwitchC.
[SwitchC] undo ntp-service server disable
# Configure SwitchA as an NTP multicast client that listens to NTP multicast packets on VLANIF 10.
[SwitchA] interface vlanif 10 [SwitchA-Vlanif10] ntp-service multicast-client [SwitchA-Vlanif10] quit
# Configure SwitchB as an NTP multicast client that listens to NTP multicast packets on VLANIF 10.
[SwitchB] interface vlanif 10 [SwitchB-Vlanif10] ntp-service multicast-client [SwitchB-Vlanif10] quit
After the configuration is complete, SwitchA and SwitchB can synchronize their clocks with the clock of SwitchC.
# Check the NTP status of SwitchC. The clock stratum is 2 and the reference clock is LOCAL, indicating that the local clock functions as the reference clock.
[SwitchC] display ntp-service status
clock status: synchronized
clock stratum: 2
reference clock ID: LOCAL(0)
nominal frequency: 100.0000 Hz
actual frequency: 100.0000 Hz
clock precision: 2^17
clock offset: 0.0000 ms
root delay: 0.00 ms
root dispersion: 10.95 ms
peer dispersion: 10.00 ms
reference time: 12:25:19.710 UTC Nov 19 2013(D635D72F.B5F41AEF)
synchronization state: clock synchronized
# Check the NTP status of SwitchA. The clock status is synchronized, indicating that the clock synchronization is complete. The clock stratum is 3, which is one stratum lower than that of the NTP server SwitchC.
[SwitchA] display ntp-service status
clock status: synchronized
clock stratum: 3
reference clock ID: 10.1.3.2
nominal frequency: 60.0002 Hz
actual frequency: 60.0002 Hz
clock precision: 2^18
clock offset: 0.0000 ms
root delay: 40.00 ms
root dispersion: 4.38 ms
peer dispersion: 34.30 ms
reference time: 12:17:21.773 UTC Mar 7 2013(C7B7F851.C5EAF25B)
synchronization state: clock synchronized
# Check the NTP status of SwitchB. The clock status is synchronized, indicating that the clock synchronization is complete. The clock stratum is 3, which is one stratum lower than that of the NTP server SwitchC.
[SwitchB] display ntp-service status
clock status: synchronized
clock stratum: 3
reference clock ID: 10.1.3.2
nominal frequency: 60.0002 Hz
actual frequency: 60.0002 Hz
clock precision: 2^18
clock offset: 0.0000 ms
root delay: 0.00 ms
root dispersion: 0.42 ms
peer dispersion: 0.00 ms
reference time: 12:17:21.773 UTC Mar 7 2013(C7B7F851.C5EAF25B)
synchronization state: clock synchronized
SwitchA configuration file
# sysname SwitchA # vlan batch 10 # ntp-service server disable ntp-service ipv6 server disable # interface Vlanif10 ip address 10.1.3.1 255.255.255.0 ntp-service multicast-client # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 # return
SwitchB configuration file
# sysname SwitchB # vlan batch 10 # ntp-service server disable ntp-service ipv6 server disable # interface Vlanif10 ip address 10.1.3.3 255.255.255.0 ntp-service multicast-client # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 # return
SwitchC configuration file
# sysname SwitchC # vlan batch 10 # ntp-service ipv6 server disable ntp-service refclock-master 2 # interface Vlanif10 ip address 10.1.3.2 255.255.255.0 ntp-service multicast-server # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 # return
Switch configuration file
# sysname Switch # vlan batch 10 # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 # interface GigabitEthernet0/0/3 port link-type hybrid port hybrid pvid vlan 10 port hybrid untagged vlan 10 # return