In NTP peer mode, both peers can be synchronized to the clock of each other.
As shown in Figure 1, three routers are located in a LAN.
Configure the clock on Device C to be an NTP master clock with the stratum as 2.
Device D takes Device C as its NTP server. That is, Device D functions as the client.
Device E takes Device D as its symmetric passive end. That is, Device E is the symmetric active end.
Interfaces 1 in this example are GE 0/1/0.
The configuration roadmap is as follows:
Configure the clock on Device C to be the NTP master clock. The clock on Device D must be synchronized to the clock on Device C.
Configure Device E and Device D to be NTP peer so that Device E should send clock synchronization requests to Device D.
Finally, the clocks on Device C, Device D and Device E can be synchronized.
To complete the configuration, you need the following data:
IP address of Device C
IP address of Device D
Stratum of the NTP master clock
Configure an IP address for each interface based on Figure 1. After configurations, the three routers can ping through each other.
For configuration details, see Configuration Files in this section.
# Configure the clock on Device C to be its own reference clock with the stratum being 2.
<HUAWEI> system-view [~HUAWEI] sysname DeviceC [*HUAWEI] commit [~DeviceC] ntp-service refclock-master 2
# Specify a listening interface on DeviceC.
[~DeviceC] ntp-service server source-interface gigabitethernet 0/1/0 [*DeviceC] commit
# On Device D, configure Device C to be its NTP server.
<HUAWEI> system-view [~HUAWEI] sysname DeviceD [*HUAWEI] commit [~DeviceD] ntp-service unicast-server 10.0.1.31 [*DeviceD] commit
# Specify a listening interface on DeviceD.
[~DeviceD] ntp-service server source-interface gigabitethernet 0/1/0 [*DeviceD] commit
After configurations, the clock on Device D can be synchronized to the clock on Device C.
Display the NTP status on Device D and find that the status is synchronized. The stratum of the clock on Device D is 3, one stratum lower than that on Device C.
[~DeviceD] display ntp-service status clock status: synchronized clock stratum: 3 reference clock ID: 10.0.1.31 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) synchronization state: clock synchronized
# On Device E, configure Device D to be the symmetric passive end.
<HUAWEI> system-view [~HUAWEI] sysname DeviceE [*HUAWEI] commit [~DeviceE] ntp-service unicast-peer 10.0.1.32 [*DeviceE] commit
Since no master clock is configured on Device E, the clock on Device E must be synchronized to the clock on Device D.
After the configurations are complete, check the NTP status of DeviceE. The command output shows that the NTP status is synchronized and the stratum of the clock on DeviceE is 4, one stratum lower than that on DeviceD.
[~DeviceE] display ntp-service status clock status: synchronized clock stratum: 4 reference clock ID: 10.0.1.32 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) synchronization state: clock synchronized
Device C configuration file
# sysname DeviceC # ntp-service refclock-master 2 ntp-service server source-interface gigabitethernet 0/1/0 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.0.1.31 255.255.255.0 # return
Device D configuration file
# sysname DeviceD # ntp-service unicast-server 10.0.1.31 ntp-service server source-interface gigabitethernet 0/1/0 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.0.1.32 255.255.255.0 # return
Device E configuration file
# sysname DeviceE # ntp-service unicast-peer 10.0.1.32 # interface GigabitEthernet0/1/0 undo shutdown ip address 10.0.1.33 255.255.255.0 # return