22-NTP Command

Download


Chapter 1  NTP Configuration Commands

1.1  NTP Configuration Commands

1.1.1  display ntp-service sessions

Syntax

display ntp-service sessions [ verbose ]

View

Any view

Parameter

verbose: Displays detailed NTP session information.

Description

Use the display ntp-service sessions command to display the information about all the sessions maintained by local NTP service.

If you do not specify the verbose keyword, the brief information about all the sessions is displayed.

 

  Caution:

An S3100-SI series switch attempts to establish connections in all NTP implementation modes except NTP server mode.

 

Example

# Display the status of all the sessions maintained by NTP service.

<H3C> display ntp-service sessions

     source    reference    stra reach  poll now offset  delay disper

********************************************************************

[12345]1.1.1.1   127.127.1.0     3   377       512  178  0.0        40.1      22.8

note: 1 source(master),2 source(peer),3 selected,4 candidate,5 configured

Table 1-1 Description on the fields of the display ntp-service sessions command

Field

Description

source

IP address of the synchronization source (device to be synchronized)

reference

Reference clock ID of the synchronization source

stra

Stratum of the clock of the synchronization source

reach

Indicates whether or not the synchronization source is reachable.

poll

Polling interval in seconds, that is, the maximum interval between two successive messages

now

The time elapsed since the latest NTP packet is sent

offset

Clock offset

delay

Network delay

disper

The maximum offset of the local clock with regard to the reference clock

 

1.1.2  display ntp-service status

Syntax

display ntp-service status

View

Any view

Parameter

None

Description

Use the display ntp-service status command to display the status of NTP service.

Example

# View the status of the local NTP service.

<H3C> display ntp-service status

 Clock status: unsynchronized

 Clock stratum: 16

 Reference clock ID: none

 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: 0.00 ms

 Peer dispersion: 0.00 ms

 Reference time: 00:00:00.000 UTC Jan 1 1900(00000000.00000000)

Table 1-2 Description on the fields of the display ntp-service status command

Field

Description

Clock status

Local clock status

Clock stratum

Stratum of the local clock

Reference clock ID

Address of the remote server or the ID of the reference clock after the local system is synchronized to a remote NTP server or a reference clock

Nominal frequency

Nominal frequency of the local system hardware clock

Actual frequency

Actual frequency of the local system hardware clock

Clock precision

Precision of the local system clock

Clock offset

Offset of the local clock with regard to the NTP server

Root delay

Roundtrip delay between the local system and the server that serves as the primary reference clock

Root dispersion

The maximum dispersion of the local clock with regard to the primary reference clock

Peer dispersion

The maximum dispersion of the remote NTP server

Reference time

Reference timestamp

 

1.1.3  display ntp-service trace

Syntax

display ntp-service trace

View

Any view

Parameter

None

Description

Use the display ntp-service trace command to display the brief information of each NTP time server along the time synchronization chain from the local device to the reference clock source.

Example

# View the brief information of each NTP time server along the time synchronization chain from the local device to the reference clock source.

<H3C> display ntp-service trace

server4: stratum 4, offset 0.0019529, synch distance 0.144135

server3: stratum 3, offset 0.0124263, synch distance 0.115784

server2: stratum 2, offset 0.0019298, synch distance 0.011993

server1: stratum 1, offset 0.0019298, synch distance 0.011993 refid  'GPS Receiver'

The above information displays the time synchronization chain of server4: serve4 is synchronized to server3, server3 is synchronized to server2, server2 is synchronized to server1, and server1 is synchronized to the reference clock source GPS Receiver.

1.1.4  ntp-service access

Syntax

ntp-service access { peer | query | server | synchronization } acl-number

undo ntp-service access { peer | query | server | synchronization }

View

System view

Parameter

peer: Allows time request and query on the local NTP server. The local clock can also be synchronized to the remote server.

query: Allows only query on the local NTP server.

server: Allows time request and query on the local NTP server. The local clock cannot be synchronized to the remote server.

synchronization: Allows only time request on the local NTP server.

acl-number: Access control list (ACL) number, in the range of 2000 to 2999.

Description

Use the ntp-service access command to set the access control permission to the local NTP server.

Use the undo ntp-service access command to cancel the configured access control permission.

By default, the access permission to the local NTP server is peer.

Configuring access control permission to the NTP server only provides a least security measure. Performing authentication is a more reliable way to improve security.

A received access is matched in this order: peer, server, synchronization, and query.

Example

# Configure the access permission of the peer defined in ACL 2076 to be peer.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service access peer 2076

# Configure the access permission of the peer defined in ACL 2028 to be server.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service access server 2028

1.1.5  ntp-service authentication enable

Syntax

ntp-service authentication enable

undo ntp-service authentication enable

View

System view

Parameter

None

Description

Use the ntp-service authentication enable command to enable the NTP authentication.

Use the undo ntp-service authentication enable command to disable the NTP authentication.

By default, the NTP authentication is disabled.

Example

# Enable the NTP authentication.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service authentication enable

1.1.6  ntp-service authentication-keyid

Syntax

ntp-service authentication-keyid key-id authentication-mode md5 value

undo ntp-service authentication-keyid key-id

View

System view

Parameter

key-id: Authentication key ID, in the range of 1 to 4294967295.

value: Authentication key, a string comprising 1 to 32 characters. Up to 1024 keys can be configured.

Description

Use the ntp-service authentication-keyid command to configure an NTP authentication key.

Use the ntp-service authentication-keyid command to remove an NTP authentication key.

By default, no NTP authentication key is configured.

As for encryption algorithm, only message digest 5 (MD5) is currently supported.

Example

# Configure an MD5 authentication key, with the key ID being 10 and the key being BetterKey.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service authentication-keyid 10 authentication-mode md5 BetterKey

1.1.7  ntp-service broadcast-client

Syntax

ntp-service broadcast-client

undo ntp-service broadcast-client

View

VLAN interface view

Parameter

None

Description

Use the ntp-service broadcast-client command to configure an Ethernet switch to operate in NTP broadcast client mode and receive NTP broadcast packets through the current interface.

Use the undo ntp-service broadcast-client command to cancel the configuration.

By default, no switch operates in the broadcast client mode..

Example

# Configure the switch to operate in the broadcast client mode and receive NTP broadcast packets through VLAN interface 1.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] interface Vlan-interface 1

[H3C-Vlan-interface1] ntp-service broadcast-client

1.1.8  ntp-service broadcast-server

Syntax

ntp-service broadcast-server [ authentication-keyid key-id | version number ]*

undo ntp-service broadcast-server

View

VLAN interface view

Parameter

authentication-keyid key-id: Specifies the key ID used when sending messages to the broadcast clients. The key-id argument ranges from 1 to 4294967295. This parameter is not needed if you specify not to perform authentication.

version number: Specifies the NTP version number which ranges from 1 to 3. The default version number is 3.

Description

Use the ntp-service broadcast-server command to configure an Ethernet switch to operate in NTP broadcast server mode and send NTP broadcast packets through the current interface.

Use the undo ntp-service broadcast-server command to cancel the configuration.

By default, no Ethernet switch operates in the NTP broadcast server mode.

Example

# Configure to send NTP broadcast packets through VLAN 1 interface, using the key numbered 4 for encryption and setting the NTP version number to 3.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] interface Vlan-interface 1

[H3C-Vlan-interface1] ntp-service broadcast-server authentication-key 4 version 3

1.1.9  ntp-service in-interface disable

Syntax

ntp-service in-interface disable

undo ntp-service in-interface disable

View

VLAN interface view

Parameter

None

Description

Use the ntp-service in-interface disable command to disable the interface from receiving NTP packets.

Use the undo ntp-service in-interface disable command to enable the interface to receive NTP packets.

By default, the interface can receive NTP packets.

Example

# Disable VLAN interface 1 from receiving NTP packets.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] interface Vlan-interface 1

[H3C-Vlan-interface1] ntp-service in-interface disable

1.1.10  ntp-service max-dynamic-sessions

Syntax

ntp-service max-dynamic-sessions number

undo ntp-service max-dynamic-sessions

View

System view

Parameter

number: Maximum number of the dynamic NTP sessions that can to be established locally. This argument ranges from 0 to 100 and defaults to 100.

Description

Use the ntp-service max-dynamic-sessions command to set the maximum number of dynamic NTP sessions that can be established locally.

Use the undo ntp-service max-dynamic-sessions command to restore the default.

By default, up to 100 NTP sessions can be established locally.

Example

# Configure the maximum number of dynamic NTP sessions that can be established locally to be 50.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service max-dynamic-sessions 50

1.1.11  ntp-service multicast-client

Syntax

ntp-service multicast-client [ ip-address ]

undo ntp-service multicast-client [ ip-address ]

View

VLAN interface view

Parameter

ip-address: Multicast IP address. ranging from 224.0.1.0 to 224.0.1.255. If not specified, it defaults to 224.0.1.1.

Description

Use the ntp-service multicast-client command to configure an Ethernet switch to operate in NTP multicast client mode and receive NTP multicast packets through the current interface.

Use the undo ntp-service multicast-client command to cancel the configuration.

By default, no Ethernet switch operates in the NTP multicast client mode.

Example

# Configure to receive NTP multicast packets through VLAN 1 interface, with the corresponding multicast group address being 224.0.1.1.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] interface Vlan-interface 1

[H3C-Vlan-interface1] ntp-service multicast-client 224.0.1.1

1.1.12  ntp-service multicast-server

Syntax

ntp-service multicast-server [ ip-address ] [ authentication-keyid key-id | ttl ttl-number | version number ]*

undo ntp-service multicast-server [ ip-address ]

View

VLAN interface view

Parameter

ip-address: Multicast IP address. ranging from 224.0.1.0 to 224.0.1.255. If not specified, it defaults to 224.0.1.1.

authentication-keyid key-id: Specifies the key ID when sending messages to the multicast clients. The key-id argument ranges from 1 to 4294967295.

ttl ttl-number: Sets the lifetime of the multicast packets. The ttl-number argument ranges from 1 to 255 and defaults to 16.

version number: Specifies the NTP version number which ranges from 1 to 3 and defaults to 3.

Description

Use the ntp-service multicast-server command to configure an Ethernet switch to operate in NTP multicast server mode and send NTP multicast packets through the current interface.

Use the undo ntp-service multicast-server command to cancel the configuration.

By default, an Ethernet switch does not operate in multicast server mode.

Example

# Configure to send NTP multicast packets through VLAN 1 interface, with the multicast group address being 224.0.1.1, the key numbered 4 used for encryption, and the NTP version number set to 3.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] interface Vlan-interface 1

[H3C-Vlan-interface1]ntp-service multicast-server 224.0.1.1

authentication-keyid 4 version 3

1.1.13  ntp-service reliable authentication-keyid

Syntax

ntp-service reliable authentication-keyid key-id

undo ntp-service reliable authentication-keyid key-id

View

System view

Parameter

key-id: Authentication key ID, in the range of 1 to 4294967295.

Description

Use the ntp-service reliable authentication-keyid command to specify an authentication key to be a trusted key.

If authentication is enabled, a client can only be synchronized to a server that can provide a trusted key.

Use the undo ntp-service reliable authentication-keyid command to cancel the configuration.

By default, an authentication key is not a trusted key.

Example

# Enable NTP authentication, with MD5 algorithm adopted, key ID being 37, the key of BetterKey and being a trusted key.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service authentication enable

[H3C] ntp-service authentication-keyid 37 authentication-mode md5 BetterKey

[H3C] ntp-service reliable authentication-keyid 37

1.1.14  ntp-service source-interface

Syntax

ntp-service source-interface interface-type interface-number

undo ntp-service source-interface

View

System view

Parameter

interface-type interface-number: Specifies an interface. The IP address of the interface serves as the source IP address contained in the NTP packet to be sent.

Description

Use the ntp-service source-interface command to specify the VLAN interface through which NTP packets are to be sent.

Use the undo ntp-service source-interface command to cancel the configuration.

If you do not want the IP addresses of other interfaces on the local device to be the destination addresses of the response packets, you can use this command to specify a specific interface to send all NTP packets. In this way, the IP address of the interface is the source IP addresses of all the NTP packets sent by the local device.

Example

# Specify the source IP addresses of all the NTP packets sent to be the IP address of VLAN 1 interface.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service source-interface Vlan-Interface 1

1.1.15  ntp-service in-interface disable

Syntax

ntp-service in-interface disable

undo ntp-service in-interface disable

View

VLAN interface view

Parameter

None

Description

Use the ntp-service in-interface disable command to disable an interface from receiving NTP packets.

Use the undo ntp-service in-interface disable command to allow an interface to receive NTP packets.

By default, an interface receives NTP packets.

Example

# Disable VLAN 1 interface from receiving NTP packets.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] interface vlan-interface1

[H3C-Vlan-Interface1] ntp-service in-interface disable

1.1.16  ntp-service unicast-peer

Syntax

ntp-service unicast-peer { remote-ip | peer-name }[ authentication-keyid key-id | priority | source-interface interface-type interface-number | version number ]*

undo ntp-service unicast-peer { remote-ip | peer-name }

View

System view

Parameter

remote-ip: IP address of the peer. This argument can only be a host address instead of a broadcast address, a multicast address or the IP address of a reference clock.

peer-name: Peer name, a string comprising 1 to 20 characters.

version number: Specifies the NTP version number. The number ranges from 1 to 3 and defaults to 3.

authentication-keyid key-id: Specifies the key ID used when sending messages to the peer. The key-id argument ranges from 1 to 4294967295. By default, the authentication is not enabled.

source-interface interface-type interface-number: Specifies an interface whose IP address is to be used as the IP addresses of the NTP packets sent to the peer. interface-type: Interface type. interface-number: Interface number.

priority: Specified the peer identified by the remote-ip argument to be the preferred peer for synchronization.

Description

Use the ntp-service unicast-peer command to configure an Ethernet switch to be an active NTP peer.

Use the undo ntp-service unicast-peer command to cancel the configuration.

By default, an Ethernet switch is not an active NTP peer.

 

&  Note:

If you specify a remote server to be the peer of the local Ethernet switch by providing the remote-ip argument in the ntp-service unicast-peer command, the local switch operates in the active peer mode. In this case, the local switch and the remote server can be synchronized to each other.

 

Example

# Configure to obtain time information from the peer with the IP of 128.108.22.44. And the local peer can also provide time information to the remote peer. Set the NTP version number to 3. The source IP addresses of NTP packets sent are that of VLAN 1 Interface.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service unicast-peer 128.108.22.44 version 3 source-interface Vlan-Interface 1

1.1.17  ntp-service unicast-server

Syntax

ntp-service unicast-server { remote-ip | server-name } [ authentication-keyid key-id | priority | source-interface interface-type interface-number | version number ]*

undo ntp-service unicast-server { remote-ip | server-name }

View

System view

Parameter

remote-ip: IP address of an NTP server. This argument can only be a host address instead of a broadcast address, multicast group address or the IP address of a reference clock.

server-name: Server name, a string comprising 1 to 20 characters.

authentication-keyid key-id: Specifies the key ID used when sending messages to the NTP server. The key-id argument ranges from 1 to 4294967295. By default, the authentication is enabled.

priority: Specifies the server identified by the remote-ip argument is the preferred server.

source-interface interface-type interface-number: Specifies an interface whose IP address is to be used as the source IP addresses of the NTP packets sent by the local device to the server. interface-type: Interface type. interface-number: Interface number.

version number: Specifies the NTP version number. The number argument ranges from 1 to 3 and defaults to 3.

Description

Use the ntp-service unicast-server command to configure an Ethernet switch to operate in NTP server mode.

Use the undo ntp-service unicast-server command to cancel the configuration.

By default, an Ethernet switch does not operate in NTP server mode.

 

&  Note:

An Ethernet can operate as a client and be synchronized to the remote NTP server identified by the remote-ip argument. Note that an NTP server will not be synchronized to the local switch.

 

Example

# Configure the local device to be synchronized to the NTP server using the IP address of 128.108.22.44, with the version number set to 3.

<H3C> system-view

System View: return to User View with Ctrl+Z.

[H3C] ntp-service unicast-server 128.108.22.44 version 3