• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 关于我们

H3C S7500系列以太网交换机 命令手册-RELEASE 3100系列(V1.04)

31-NTP命令

本章节下载  (156.7 KB)

31-NTP命令


第1章  NTP配置命令

1.1  NTP配置命令

1.1.1  display ntp-service sessions

【命令】

display ntp-service sessions [ verbose ]

【视图】

任意视图

【参数】

verbose:显示NTP服务维护的所有sessions的详细信息。如果不带这个关键字,则只显示所有sessions的简要信息。

【描述】

display ntp-service sessions命令用来显示本地设备NTP服务维护的所有sessions的状态。

  注意:

除NTP服务器模式外,其余的NTP工作模式均会建立连接。

 

【举例】

# 显示NTP服务维护的所有sessions的状态。

<H3C> display ntp-service sessions

source           reference   stra reach poll  now offset  delay disper

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

[12345]1.0.1.11  LOCAL(0)        3    377   64   16   -0.4    0.0    0.9

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

1.1.2  display ntp-service status

【命令】

display ntp-service status

【视图】

任意视图

【参数】

【描述】

display ntp-service status命令用来显示NTP服务的状态信息。

【举例】

# 显示NTP服务的状态信息。

<H3C> display ntp-service status

Service status:enabled

clock status: unsynchronized

 clock stratum: 16

 reference clock ID: none

 nominal frequency: 100.0000 Hz

 actual frequency: 100.0000 Hz

 clock precision: 2^18

 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)

显示信息的解释如下表:

表1-1 NTP服务的状态信息

显示信息

意义

Service status

NTP服务状态:使能或禁止

clock status: unsynchronized

本地时钟状态:未被同步到任何一个远程NTP服务器

clock stratum

本地时钟所处的NTP stratum

reference clock ID

当本地系统已被同步到一个远程NTP服务器或某个时钟源时,指示远程服务器的地址或时钟源的标识。

nominal frequency

本地系统硬件时钟的标称频率

actual frequency

本地系统硬件时钟的实际频率

clock precision

本地系统时钟的精度

clock offset

本地时钟相对NTP服务器的offset

root delay

本地到主参考时钟总的delay

root dispersion

本地相对主参考时钟的dispersion

peer dispersion

远程NTP服务器的dispersion

reference time

参考时间戳

 

1.1.3  display ntp-service trace

【命令】

display ntp-service trace

【视图】

任意视图

【参数】

【描述】

display ntp-service trace命令用来显示从本地设备回溯到参考时钟源的各个NTP时间服务器的简要信息。

从本地设备,沿着时间同步NTP服务器链,一直回溯到参考时钟源,并显示各个NTP服务器的简要信息。

【举例】

# 显示从本地设备回溯到主参考时钟源的各个NTP时间服务器的简要信息。

<H3C> display ntp-service trace

server 127.0.0.1,stratum 8, offset 0.000000, synch distance 0.00000

 refid 127.127.1.0

1.1.4  ntp-service access

【命令】

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

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

【视图】

系统视图

【参数】

query:只允许对本地NTP服务进行查询。

synchronization:只允许对本地NTP服务进行时间请求。

server:可以对本地NTP服务进行时间请求和查询,但本地时钟不会同步到远程服务器。

peer:可以对本地NTP服务进行时间请求和查询,本地时钟也可以同步到远程服务器。

acl-number:基本访问列表标号,取值范围2000~2999。

【描述】

ntp-service access命令用来设置对本地设备服务的访问控制权限。undo ntp-service access命令用来取消设置的访问控制权限。

缺省情况下,没有设置对本地设备服务的访问控制权限。

设置对本地设备NTP服务的访问控制权限。这里提供了一种最小限度的安全措施,更安全的方法是进行身份验证。当有一个访问请求时,按照最小访问限制到最大访问限制依次匹配,以第一个匹配的为准,匹配顺序为peerserversynchronizationquery

【举例】

# 设置允许第2000号访问列表中的peer可以对本地设备进行时间请求、查询控制、时间同步。

<H3C>system-view

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

[H3C] ntp-service access peer 2000

# 只允许第2000号访问列表中的peer对本地设备进行时间请求、查询控制。

<H3C>system-view

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

[H3C] ntp-service access synchronization 2000

1.1.5  ntp-service authentication enable

【命令】

ntp-service authentication enable

undo ntp-service authentication enable

【视图】

系统视图

【参数】

【描述】

ntp-service authentication enable命令用来设置NTP-service身份验证功能,undo ntp-service authentication enable命令用来取消身份验证功能。

缺省情况下,不设置NTP身份验证功能。

【举例】

# 启动NTP身份验证功能。

<H3C>system-view

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

[H3C] ntp-service authentication enable

1.1.6  ntp-service authentication-keyid

【命令】

ntp-service authentication-keyid number authentication-mode md5 value

undo ntp-service authentication-keyid number

【视图】

系统视图

【参数】

number:密钥编号,范围从1~4294967295。

value:密钥本身,1~32个ASCII码字符。

【描述】

ntp-service authentication-keyid命令用来设置NTP验证密钥。undo ntp-service authentication-keyid命令用来取消NTP验证密钥。

缺省情况下,无NTP验证密钥。

目前系统只支持MD5的密钥验证算法。

【举例】

# 设置MD5身份验证密钥,密钥ID号为10,密钥为hello。

<H3C>system-view

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

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

1.1.7  ntp-service broadcast-client

【命令】

ntp-service broadcast-client

undo ntp-service broadcast-client

【视图】

VLAN接口视图

【参数】

【描述】

ntp-service broadcast-client命令用来配置NTP广播客户模式。undo ntp-service broadcast-client命令用来取消NTP广播客户模式。

缺省情况下,不配置NTP广播客户服务。

指定本地设备上的本接口来接收NTP广播消息包,本地设备运行在客户端(broadcast-client)模式。本地设备首先侦听来自服务器的广播消息包,当接收到第一个广播消息包时,本地设备为了估计网络延迟先启用一个短暂的client/server模式与远程服务器交换消息,然后本地设备就进入client模式,继续侦听广播消息包的到来,根据到来的广播消息包对本地时钟进行同步。

【举例】

# 配置在Vlan-Interface1接口上接收NTP广播消息。

<H3C>system-view

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

[H3C] interface vlan-interface1

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

1.1.8  ntp-service broadcast-server

【命令】

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

undo ntp-service broadcast-server

【视图】

VLAN接口视图

【参数】

authentication-keyid:定义身份验证密钥。

keyid:向广播客户端发送消息时使用的密钥ID号,取值范围为1~4294967295。

version:定义NTP版本号。

number:NTP版本号,范围为1~3。

【描述】

ntp-service broadcast-server命令用来配置NTP广播服务器模式。undo ntp-service broadcast-server命令用来取消NTP广播服务器模式。

缺省情况下,不配置NTP广播服务器。不指定NTP版本号时,NTP版本号缺省为3。

指定本地设备上的一个接口来发送NTP广播消息包,本地运行在服务器(broadcast-server)模式,作为广播服务器周期性地发送广播消息到广播客户端。

【举例】

# 配置在Vlan-Interface1接口上发送NTP广播消息包,用4号密钥进行加密,设置NTP版本号为3。

<H3C>system-view

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

[H3C] interface vlan-interface1

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

1.1.9  ntp-service disable

【命令】

ntp-service disable

undo ntp-service disable

【视图】

系统视图

【参数】

【描述】

ntp-service disable命令用来关闭NTP服务,禁止NTP报文收发。undo ntp-service disable命令用来恢复NTP服务。

缺省情况下,NTP服务是打开的。

【举例】

# 在设备上禁止NTP服务。

<H3C>system-view

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

[H3C] ntp-service disable

1.1.10  ntp-service in-interface disable

【命令】

ntp-service in-interface disable

undo ntp-service in-interface disable

【视图】

VLAN接口视图

【参数】

【描述】

ntp-service in-interface disable命令用来禁止接口接收NTP消息。undo ntp-service in-interface disable命令用来允许接口接收NTP消息。

缺省情况下,允许接口接收NTP消息。

【举例】

# 禁止Vlan-Interface1接收NTP消息包。

<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.11  ntp-service max-dynamic-sessions

【命令】

ntp-service max-dynamic-sessions number

undo ntp-service max-dynamic-sessions

【视图】

系统视图

【参数】

number:本地允许建立连接的数目,范围0~100。

【描述】

ntp-service max-dynamic-sessions命令用来设置本地允许建立的最大的动态连接数。undo ntp-service max-dynamic-sessions命令用来恢复最大动态连接数的缺省值。

缺省情况下,本地允许建立的最大动态连接数为100个。

&  说明:

只有NTP对等体模式、NTP广播客户端模式和NTP组播客户端模式建立的是动态连接,其余工作模式建立的是静态连接。

 

【举例】

# 设置本地允许建立的最大动态连接数为50。

<H3C>system-view

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

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

1.1.12  ntp-service multicast-client

【命令】

ntp-service multicast-client [ ip-address ]

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

【视图】

VLAN接口视图

【参数】

ip-address:组播IP地址,D类地址。

【描述】

ntp-service multicast-client命令用来配置NTP组播客户模式。undo ntp-service multicast-client命令用来取消NTP组播客户模式。

缺省情况下,不配置NTP组播客户服务,不指定组播IP地址时,组播IP地址缺省为224.0.1.1。

指定本地设备上的一个接口来接收NTP组播消息包,本地设备运行在client(multicast-client)模式。本地设备首先侦听来自服务器的组播消息包,当接收到第一个组播消息包时,本地服务器为了估计网络延迟先启用一个短暂的client/server模式与远程服务器交换消息,然后本地设备就进入client模式,继续侦听组播消息包的到来,根据到来的组播消息包对本地时钟进行同步。

【举例】

# 配置在Vlan-Interface1接口上接收NTP组播消息包,组播消息包对应的组播组地址为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.13  ntp-service multicast-server

【命令】

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

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

【视图】

VLAN接口视图

【参数】

ip-address:组播IP地址,D类地址,缺省为224.0.1.1。

authentication-keyid:定义身份验证密钥。

keyid:向组播客户端发送消息时使用的密钥ID号,范围1~4294967295。

ttl:定义组播包的生存期。

ttl-number:组播包生存期的大小,范围为1~255。

version:定义NTP版本号。

number:NTP版本号,范围为1~3。

【描述】

ntp-service multicast-server命令用来配置NTP组播服务器模式,在配置时如果不指定IP地址,则交换机自动选择组播地址为224.0.1.1。undo ntp-service multicast-server命令用来删除NTP组播服务器的配置,如果不指定IP地址,则删除组播地址为224.0.1.1的组播服务器的配置。

缺省情况下,不配置NTP组播服务器;不指定组播IP地址时,组播IP地址缺省为224.0.1.1;不指定NTP版本时,NTP版本号缺省为3。

指定本地设备上的一个接口来发送NTP组播消息包,本地设备运行在服务器(multicast-server)模式,作为组播服务器周期性地发送组播消息到组播客户端。

【举例】

# 配置在Vlan-Interface1接口上发送NTP组播消息包,组播组地址为224.0.1.1,用4号密钥进行加密,设置NTP版本号为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.14  ntp-service refclock-master

【命令】

ntp-service refclock-master [ ip-address ] [ stratum ]

undo ntp-service refclock-master [ ip-address ]

【视图】

系统视图

【参数】

ip-address:参考时钟IP地址127.127.1.u,其中u的取值范围为0~3。

stratum:指定本地时钟所处的层数,范围为1~15。

【描述】

ntp-service refclock-master命令用来设置外部参考时钟或本地时钟作为NTP主时钟。undo ntp-service refclock-master命令用来取消NTP主时钟设置。

缺省情况下,不设置NTP主时钟。不指定ip-address参数时,默认设置本地时钟为NTP主时钟。不指定stratum参数时,本地时钟所处的层数缺省为8。

设置外部参考时钟或本地时钟作为NTP主时钟,为其它设备提供同步时间。ip-address为参考时钟IP地址127.127.1.u,当不指定IP地址时,默认设置本地时钟为NTP主时钟;可以指定NTP主时钟所处的层次数。

【举例】

# 设置本地设备时钟作为NTP主时钟,为其他peer提供同步时间,stratum为3。

<H3C>system-view

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

[H3C] ntp-service refclock-master 3

1.1.15  ntp-service reliable authentication-keyid

【命令】

ntp-service reliable authentication-keyid number

undo ntp-service reliable authentication-keyid number

【视图】

系统视图

【参数】

number:密钥编号,范围从1~4294967295。

【描述】

ntp-service reliable authentication-keyid命令用来指定密钥是可信的。undo ntp-service reliable authentication-keyid命令用来取消当前配置。

缺省情况下,不设置可信验证密钥。

当启用身份验证时,该命令用于指定一个或多个密钥是可信的,也就是说client只会同步到提供可信密钥的服务器,如果服务器提供的密钥不是可信的密钥,那么client不会与其同步。

【举例】

# 设置启用NTP身份验证,采用MD5加密方法,密钥ID号为37,密钥为 BetterKey,指定该密钥为可信密钥。

<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.16  ntp-service source-interface

【命令】

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

undo ntp-service source-interface

【视图】

系统视图

【参数】

interface-type:接口类型,与接口编号interface-number共同确定一个接口。

interface-number:接口编号,与接口类型interface-type共同确定一个接口。

【描述】

ntp-service source-interface命令用来指定本地发送NTP消息的接口。undo ntp-service source-interface命令用来取消当前配置。

缺省情况下,源地址根据输出接口来确定。

指定本地发送所有NTP消息时,消息包中的源IP地址都用一个特定的IP地址,该IP地址就是从所指定的接口上获取。当不想本地设备上其它接口的IP地址成为应答消息的目的地址时,用该命令指定一个特定接口来发送所有的NTP消息包。

【举例】

# 指定NTP所有输出消息包的源IP地址都用接口Vlan-Interface1的IP地址。

<H3C>system-view

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

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

1.1.17  ntp-service unicast-peer

【命令】

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

undo ntp-service unicast-peer { ip-address | server-name }

【视图】

系统视图

【参数】

ip-address:远程服务器IP地址。

server-name:NTP服务器的主机名字。取值范围为1~20个字符。

version:定义NTP版本号。

number:NTP版本号,范围为1~3。

authentication-keyid:定义身份验证密钥。

keyid:向该远程服务器发送消息使用的密钥ID号,范围为1~4294967295。

source-interface:指定接口名称。

interface-type:接口类型,与接口编号interface-number共同确定一个接口。

interface-number:接口编号,与接口类型interface-type共同确定一个接口。

priority:指定该服务器为优先选择的服务器。

【描述】

ntp-service unicast-peer命令用来配置NTP对等体模式。undo ntp-service unicast-peer命令用来取消NTP对等体模式。

缺省情况下,不配置NTP对等体。不指定number参数时,NTP版本号缺省为3。不指定authentication-keyid时,不使用身份验证。不是优先选择的服务器。

设置以ip-address所指定的远程服务器作为本地的对等体,本地运行在主动对等体模式。ip-address是一个主机地址,不能为广播、组播地址或参考时钟的IP地址。在这种配置下,本地设备能同步到远程服务器,远程服务器也能同步到本地服务器。

【举例】

# 本地被配置成由peer 128.108.22.44提供同步时间,本地对等体也能为peer提供同步时间,版本号为3。NTP消息包的IP地址从Vlan-Interface1获得。

<H3C>system-view

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

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

1.1.18  ntp-service unicast-server

【命令】

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

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

【视图】

系统视图

【参数】

ip-address:远程服务器IP地址。

server-name:NTP服务器的主机名字。取值范围为1~20个字符。

version:定义NTP版本号。

number:NTP版本号,范围为1~3。

authentication-keyid:定义身份验证密钥。

keyid:向该远程服务器发送消息使用的密钥ID号,范围1~4294967295。

source-interface:指定接口名称。

interface-type:接口类型,与接口编号interface-number共同确定一个接口。

interface-number:接口编号,与接口类型interface-type共同确定一个接口。

priority:指定该服务器为优先选择的服务器。

【描述】

ntp-service unicast-server命令用来配置NTP服务器模式。undo ntp-service unicast-server命令用来取消NTP服务器模式。

缺省情况下,不配置NTP服务器。不指定number参数时,NTP版本号缺省为3。不配置authentication-keyid时,不启用身份验证。

ip-address所指定的远程服务器作为本地时间服务器。ip-address是一个主机地址,不能为广播、组播地址或参考时钟的IP地址。本地设备工作在client模式,在这种工作模式下,只能是本地客户机同步到远程服务器,而远程服务器不会同步到本地客户机。

【举例】

# 本地设备被配置成由服务器128.108.22.44提供同步时间,版本号为3。

<H3C>system-view

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

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

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们