H3C WX3000 Series Unified Switches Switching Engine Command Reference-6W103

HomeSupportWirelessH3C WX3000 Series Unified SwitchesReference GuidesCommand ReferencesH3C WX3000 Series Unified Switches Switching Engine Command Reference-6W103
26-NTP Command
Title Size Download
26-NTP Command 77.4 KB

 

To protect unused sockets against attacks by malicious users and improve security, the device provide the following functions:

l          UDP port 123 is opened only when the NTP feature is enabled.

l          UDP port 123 is closed as the NTP feature is disabled.

These functions are implemented as follows:

l          Execution of one of the ntp-service unicast-server, ntp-service unicast-peer, ntp-service broadcast-client, ntp-service broadcast-server, ntp-service multicast-client, and ntp-service multicast-server commands enables the NTP feature and opens UDP port 123 at the same time.

l          Execution of the undo form of one of the above six commands disables all implementation modes of the NTP feature and closes UDP port 123 at the same time.

 

NTP Configuration Commands

display ntp-service sessions

Syntax

display ntp-service sessions [ verbose ]

View

Any view

Parameters

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 services.

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

Examples

# View the brief information of all sessions maintained by NTP services.

<device> 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

Total associations :  1

Table 1-1 display ntp-service sessions command output description

Field

Description

source

IP address of the synchronization source

reference

Reference clock ID of the synchronization source

l      If the reference clock is the local clock, the value of this field is related to the value of the stra field:

When the value of the stra field is 0 or 1, this field will be “LOCL”; when the stra field has another value, this filed will be the IP address of the local clock.

l      If the reference clock is the clock of another device on the network, the value of this field will be the IP address of that device.

stra

Stratum of the clock of the synchronization source

reach

Reachability count of the clock source. 0 indicates that the clock source in unreachable

poll

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

now

Time elapsing since the last NTP packet is sent

offset

The offset of the system clock relative to the reference clock, in milliseconds

delay

Network delay, that is, the roundtrip delay from the local device to the clock source, in milliseconds

disper

Maximum offset of the local clock relative to the reference clock

[12345]

1: Clock source selected by the system, namely the current reference source, with a system clock stratum level smaller than or equal to 15

2: Stratum level of this clock source is smaller than or equal to 15

3: This clock source has passed the clock selection process

4: This clock source is a candidate clock source

5: This clock source was created by a configuration command

Total associations

Total number of associations

 

The device does not establish a session with its client when it works in the NTP server mode, but does so when it works in other NTP implementation modes.

 

display ntp-service status

Syntax

display ntp-service status

View

Any view

Parameters

None

Description

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

Examples

# View the status of the NTP service of the local device.

<device> display ntp-service status

 Clock status: synchronized

 Clock stratum: 4

 Reference clock ID: 1.1.1.11

 Nominal frequency: 60.0002 Hz

 Actual frequency: 60.0002 Hz

 Clock precision: 2^18

 Clock offset: 0.8174 ms

 Root delay: 37.86 ms

 Root dispersion: 45.98 ms

 Peer dispersion: 35.78 ms

 Reference time: 16:30:46.078 UTC Sep 29 2006(C9689FB6.1431593E) 

Table 1-2 display ntp-service status command output description

Field

Description

Clock status

Status of the local clock

Clock stratum

Stratum of the local clock

Reference clock ID

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

Nominal frequency

Nominal frequency of the local hardware clock

Actual frequency

Actual frequency of the local hardware clock

Clock precision

Precision of the local hardware clock

Clock offset

Offset of the local clock relative to the reference clock

Root delay

Roundtrip delay between the local clock and the primary reference clock source

Root dispersion

Maximum dispersion of the local clock relative to the primary reference clock

Peer dispersion

Maximum dispersion of the remote NTP server

Reference time

Reference timestamp

 

display ntp-service trace

Syntax

display ntp-service trace

View

Any view

Parameters

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.

Examples

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

<device> 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: server4 is synchronized to server3, server3 to server2, server2 to server1, and server1 to the reference clock source GPS receiver.

ntp-service access

Syntax

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

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

View

System view

Parameters

query: Control query right. This level of right permits the peer device to perform control query to the NTP service on the local device but does not permit the peer device to synchronize its clock to the local device. The so-called “control query” refers to query of state of the NTP service, including alarm information, authentication status, clock source information, and so on.

synchronization: Synchronization right. This level of right permits the peer device to synchronize its clock to the local device but does not permit the peer device to perform control query.

server: Server right. This level of right permits the peer device to perform synchronization and control query to the local device but does not permit the local device to synchronize its clock to the peer device.

peer: Peer right. This level of right permits the peer device to perform synchronization and control query to the local device and also permits the local device to synchronize its clock to the peer device.

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

Description

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

Use the undo ntp-service access command to remove the configured access control right to the local NTP server.

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

The ntp-service access command only provides a minimal degree of security measure. A more secure way is to perform identity authentication.

The right of a received access request is matched from the highest to the lowest in order of peer, server, synchronization, and query.

Examples

# Configure the peer in ACL 2076 to have the full access right to the local NTP server, including time request, query control, and time synchronization.

<device> system-view

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

[device] ntp-service access peer 2076

# Configure the peer in ACL 2028 to have the right to access and query the local NTP server.

<device> system-view

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

[device] ntp-service access server 2028

ntp-service authentication enable

Syntax

ntp-service authentication enable

undo ntp-service authentication enable

View

System view

Parameters

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.

Examples

# Enable the NTP authentication.

<device> system-view

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

[device] ntp-service authentication enable

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

Parameters

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.

Currently, the system only supports the message digest 5 (MD5) algorithm.

Examples

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

<device> system-view

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

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

ntp-service broadcast-client

Syntax

ntp-service broadcast-client

undo ntp-service broadcast-client

View

VLAN interface view

Parameters

None

Description

Use the ntp-service broadcast-client command to configure a device to operate in the NTP broadcast client mode and receive NTP broadcast messages through the current interface.

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

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

Examples

# Configure the device to operate in the broadcast client mode and receive NTP broadcast messages through Vlan-interface1.

<device> system-view

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

[device] interface Vlan-interface1

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

ntp-service broadcast-server

Syntax

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

undo ntp-service broadcast-server

View

VLAN interface view

Parameters

authentication-keyid key-id: Specifies the key ID used for sending messages to broadcast clients. The key-id argument ranges from 1 to 4294967295. You do not need to configure authentication-keyid key-id if authentication is not required.

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 a device to operate in the NTP broadcast server mode and send NTP broadcast messages through the current interface.

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

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

Examples

# Configure the device to send NTP broadcast messages through Vlan-interface1 and use authentication key 4 for encryption, and set the NTP version number to 3.

<device> system-view

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

[device] interface Vlan-interface 1

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

ntp-service in-interface disable

Syntax

ntp-service in-interface disable

undo ntp-service in-interface disable

View

VLAN interface view

Parameters

None

Description

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

Use the undo ntp-service in-interface disable command to restore the default.

By default, the interface can receive NTP messages.

Examples

# Disable Vlan-interface1 from receiving NTP messages.

<device> system-view

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

[device] interface Vlan-interface 1

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

ntp-service max-dynamic-sessions

Syntax

ntp-service max-dynamic-sessions number

undo ntp-service max-dynamic-sessions

View

System view

Parameters

number: Maximum number of the dynamic NTP sessions that can be established locally. This argument ranges from 0 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 dynamic NTP sessions can be established locally.

Examples

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

<device> system-view

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

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

ntp-service multicast-client

Syntax

ntp-service multicast-client [ ip-address ]

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

View

VLAN interface view

Parameters

ip-address: Multicast IP address, in the range of 224.0.1.0 to 224.0.1.255. The default IP address is 224.0.1.1.

Description

Use the ntp-service multicast-client command to configure a device to operate in the NTP multicast client mode and receive NTP multicast messages through the current interface.

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

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

Examples

# Configure the device to receive NTP multicast messages through Vlan-interface1, with the multicast IP address being 224.0.1.2.

<device> system-view

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

[device] interface Vlan-interface 1

[device-Vlan-interface1] ntp-service multicast-client 224.0.1.2

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

Parameters

ip-address: Multicast IP address, in the range of 224.0.1.0 to 224.0.1.255. The default IP address is 224.0.1.1.

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

ttl ttl-number: Defines the lifetime of multicast messages. 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 a device to operate in the NTP multicast server mode and send NTP multicast messages through the current interface.

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

By default, no device operates in multicast server mode.

Examples

# Configure the device to send NTP multicast messages through Vlan-interface1, and set the multicast group address to 224.0.1.2, keyid to 4, and the NTP version number to 3.

<device> system-view

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

[device] interface Vlan-interface 1

[device-Vlan-interface1]ntp-service multicast-server 224.0.1.2

authentication-keyid 4 version 3

ntp-service reliable authentication-keyid

Syntax

ntp-service reliable authentication-keyid key-id

undo ntp-service reliable authentication-keyid key-id

View

System view

Parameters

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 as 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 remove the configuration.

By default, no trusted key is configured.

Examples

# Enable NTP authentication. The encryption algorithm is MD5, the key ID is 37, and the trusted key is BetterKey.

<device> system-view

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

[device] ntp-service authentication enable

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

[device] ntp-service reliable authentication-keyid 37

ntp-service source-interface

Syntax

ntp-service source-interface Vlan-interface vlan-id

undo ntp-service source-interface

View

System view

Parameters

vlan-interface vlan-id: Specifies an interface. The IP address of the interface serves as the source IP address of sent NTP messages. The vlan-id argument indicates the ID of the specified VLAN interface.

Description

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

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

If you do not want the IP addresses of the other interfaces on the local device to be the destination addresses of response messages, 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 address of all NTP messages sent by the local device.

Examples

# Specify the source IP addresses of all sent NTP messages as the IP address of Vlan-interface1.

<device> system-view

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

[device] ntp-service source-interface Vlan-interface 1

ntp-service unicast-peer

Syntax

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

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

View

System view

Parameters

remote-ip: IP address of the NTP symmetric-passive peer. This argument cannot be a broadcast address, a multicast address, or the IP address of the local reference clock.

peer-name: Symmetric-passive peer host name, a string comprising 1 to 20 characters.

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

priority: Specifies the peer identified by the remote-ip argument as the preferred peer for synchronization.

source-interface Vlan-interface vlan-id: Specifies an interface whose IP address serves as the source IP address of NTP message sent to the peer. vlan-id is the VLAN interface number.

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

Description

Use the ntp-service unicast-peer command to configure a device to be an active NTP peer.

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

By default, the local device is not configured as an active NTP peer.

 

If you use remote-ip to specify a remote device as the peer of the local device, the local device operates in the symmetric-active peer mode. In this case, the local device and the remote device can be synchronized to each other.

 

Examples

# Configure the local device to obtain time information from the peer with the IP address 128.108.22.44 and also to provide time information to the peer. Set the NTP version number to 3. The source IP address of NTP messages is the IP address of Vlan- interface1.

<device> system-view

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

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

ntp-service unicast-server

Syntax

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

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

View

System view

Parameters

remote-ip: IP address of an NTP server. This argument cannot be a broadcast address, multicast group address, or IP address of the local clock.

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

authentication-keyid key-id: Specifies the key ID used for sending messages to the NTP server. The key-id argument ranges from 1 to 4294967295. You do not need to configure authentication-keyid key-id if authentication is not required.

priority: Specifies the server identified by the remote-ip or the server-name argument as the preferred server.

source-interface Vlan-interface vlan-id: Specifies an interface whose IP address serves as the source IP address of NTP packets sent by the local device to the server.

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 a device to operate in the NTP client mode.

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

By default, no device operates in the NTP client mode.

 

The remote device specified by remote-ip serves as the NTP server and the local device serves as the NTP client. The client can be synchronized to the server while the server cannot be synchronized to the client.

 

Examples

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

<device> system-view

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

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

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网