Example for Configuring NTP Peer Mode
In NTP peer mode, both peers can be synchronized to the clock of each other.
Networking Requirements
As shown in Figure 5-2, 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.
Configuration Roadmap
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.
Data Preparation
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
Procedure
- Configure IP addresses for Device C, Device D, and Device E.
Configure an IP address for each interface based on Figure 5-2. After configurations, the three routers can ping through each other.
For configuration details, see Configuration Files in this section.
- Configure the NTP server/client mode.
# Configure the clock on Device C to be its own reference clock with the stratum being 2.
<DeviceC> system-view
[~DeviceC] ntp-service refclock-master 2
[*DeviceC] commit
# On Device D, configure Device C to be its NTP server.
<DeviceD> system-view
[~DeviceD] ntp-service unicast-server 3.0.1.31
[*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: 3.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
- Configure the unicast NTP peer mode.
# On Device E, configure Device D to be the symmetric passive end.
<DeviceE> system-view
[~DeviceE] ntp-service unicast-peer 3.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.
- Verify the configuration.
After the configurations are complete, check the status of Device E after clock synchronization and you can find that the status is "synchronized". That is, clock synchronization completes. You can also find that the stratum of the clock on Device E is 4, one stratum lower than that on Device D.
[~DeviceE] display ntp-service status
clock status: synchronized
clock stratum: 4
reference clock ID: 3.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
Configuration Files
Device C configuration file
#
sysname DeviceC
#
ntp-service refclock-master 2
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 3.0.1.31 255.255.255.0
#
return
Device D configuration file
#
sysname DeviceD
#
ntp-service unicast-server 3.0.1.31
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 3.0.1.32 255.255.255.0
#
return
Device E configuration file
#
sysname DeviceE
#
ntp-service unicast-peer 3.0.1.32
#
interface GigabitEthernet0/1/0
undo shutdown
ip address 3.0.1.33 255.255.255.0
#
return