Example for Configuring NTP Symmetric Peer Mode
Networking Requirements
As shown in Figure 3-3, three devices are on a local area network (LAN).
The clocks of the devices on the LAN need to be synchronized to facilitate device management. SwitchA has synchronized its clock with an authoritative clock, the Global Positioning System (GPS), through a network. The user requires SwitchB and SwitchC to synchronize their clocks to the clock of SwitchA.
Configuration Roadmap
You can configure the NTP protocol to synchronize time, and use the NTP symmetric peer mode to meet the user's requirement for time synchronization. The configuration roadmap is as follows:
- Configure the local clock of SwitchA as the NTP primary clock.
- The NTP unicast server/client mode is used to synchronize the clocks of SwitchB and SwitchA. SwitchA functions as the server, and SwitchB functions as the client.
The symmetric peer mode is used to synchronize the clocks of SwitchB and SwitchC. SwitchC functions as the symmetric active peer and sends a clock synchronization request to SwitchB.
Procedure
- Configure IP addresses for SwitchA, SwitchB and SwitchC.
Configure an IP address for each interface according to Figure 3-3. After the configurations are complete, the three switches can ping each other.
# Configure an IP address on SwitchA. For details about the configurations of SwitchB and SwitchC, see "Configuration Files".
<Quidway> system-view [Quidway] sysname SwitchA [SwitchA] vlan 100 [SwitchA-vlan100] quit [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ip address 10.0.0.1 24 [SwitchA-Vlanif100] quit [SwitchA] interface ethernet 0/0/1 [SwitchA-Ethernet0/0/1] port hybrid untagged vlan 100 [SwitchA-Ethernet0/0/1] port hybrid pvid vlan 100 [SwitchA-Ethernet0/0/1] quit
- Configure the NTP client/server mode.
# Set the local clock of SwitchA as the NTP primary clock, and set the clock stratum to 2.
[SwitchA] ntp-service refclock-master 2
# Specify on SwitchB that SwitchA functions as the NTP server of SwitchB.
<SwitchB> system-view [SwitchB] ntp-service unicast-server 10.0.0.1
After the preceding configuration is complete, SwitchB can synchronize its clock with the clock of SwitchA.
# Check the NTP status of SwitchB, and you can find that the clock status is "synchronized", indicating that the synchronization is complete. The stratum of the clock is 3, which is one stratum lower than that of the clock of SwitchA.
[SwitchB] display ntp-service status clock status: synchronized clock stratum: 3 reference clock ID: 10.0.0.1 nominal frequency: 64.0029 Hz actual frequency: 64.0029 Hz clock precision: 2^7 clock offset: 0.0000 ms root delay: 62.50 ms root dispersion: 0.20 ms peer dispersion: 7.81 ms reference time: 06:52:33.465 UTC Mar 7 2006(C7B7AC31.773E89A8)
- Configure the NTP unicast symmetric peer mode.
# Specify on SwitchC that SwitchB functions as the symmetric passive peer of SwitchC.
<SwitchC> system-view [SwitchC] ntp-service unicast-peer 10.0.0.2
Because SwitchC is not configured with a primary clock and its clock stratum is lower than that of SwitchB, SwitchC synchronizes its clock with the clock of SwitchB.
- Verify the configuration.
Monitor the status of SwitchC after the synchronization. The clock of SwitchC is in "synchronized" status, indicating that the synchronization is complete. The clock stratum of SwitchC is 4, which is one stratum lower than that of the symmetric passive peer SwitchB.
# Display the clock status of SwitchC.
[SwitchC] display ntp-service status clock status: synchronized clock stratum: 4 reference clock ID: 10.0.0.2 nominal frequency: 64.0029 Hz actual frequency: 64.0029 Hz clock precision: 2^7 clock offset: 0.0000 ms root delay: 124.98 ms root dispersion: 0.15 ms peer dispersion: 10.96 ms reference time: 06:55:50.784 UTC Mar 7 2006(C7B7ACF6.C8D002E2)
Configuration Files
Configuration file of SwitchA
# sysname SwitchA # ntp-service refclock-master 2 # vlan batch 100 # interface Vlanif100 ip address 10.0.0.1 255.255.255.0 # interface Ethernet0/0/1 port hybrid pvid vlan 100 port hybrid untagged vlan 100 # return
Configuration file of SwitchB
# sysname SwitchB # ntp-service unicast-server 10.0.0.1 # vlan batch 100 # interface Vlanif100 ip address 10.0.0.2 255.255.255.0 # interface Ethernet0/0/1 port hybrid pvid vlan 100 port hybrid untagged vlan 100 # return
Configuration file of SwitchC
# sysname SwitchC # ntp-service unicast-peer 10.0.0.2 # vlan batch 100 # interface Vlanif100 ip address 10.0.0.3 255.255.255.0 # interface Ethernet0/0/1 port hybrid pvid vlan 100 port hybrid untagged vlan 100 # return