信创交换机(S5300G/S6300G、S3200G)

信锐技术自主研发的千兆盒式交换机产品,支持主流协议标准和应用程序,可方便快速的部署和管理,满足下一代企业网、数据中心、城域网和超融合等多种应用场合需求。
{{sendMatomoQuery("信创交换机(S5300G/S6300G、S3200G)","IP业务命令")}}

IP业务命令

更新时间:2025-07-14

5.1ARP命令

5.1.1arp

命令功能

此命令添加一条静态ARP,使用该命令的no形式来删除静态配置的ARP

命令语法

arp ( vrf VRF-NAME | ) IP-ADDRESS HARDWARE-ADDRESS

no arp ( vrf VRF-NAME | ) IP-ADDRESS

参数

参数说明

参数取值

vrf VRF-NAME

VRF实例名字

不超过31个字符的字符串

IP-ADDRESS

要添加的静态映射的IP地址

IPv4地址

HARDWARE-ADDRESS

要添加的静态映射的MAC地址,格式为HHHH.HHHH.HHHH

MAC地址

命令模式

全局配置模式

默认配置

默认无静态ARP表项

使用说明

所添加的IP地址不能为广播地址、多播地址或者本地环回地址;或者形如0.X.X.X/8的地址;所添加的MAC地址不能为广播地址、多播地址,设备本身地址,或者全0地址;添加的静态ARP不能被clear arp-cache命令删除。

举例说明

下面的例子显示了如何添加一条静态ARP

Switch# configure terminal
Switch(config)# arp 10.31.7.19 0800.0900.1834

相关命令

clear arp-cache

5.1.2arp retry-interval

命令功能

此命令设置本地发送ARP请求报文的频率,即解析同一个IP地址,发送连续2ARP请求报文的时间间隔。使用关键字no恢复此时间间隔为默认值。

命令语法

arp retry-interval SECONDS

no arp retry-interval

参数

参数说明

参数取值

SECONDS

发送ARP请求报文的时间间隔,以秒为单位

0-3

命令模式

端口配置模式

默认配置

1

使用说明

默认重发ARP请求报文的时间间隔为1秒;此功能不能配置在2层端口上;使用no switchport命令关闭端口的二层功能。

举例说明

设置设备发送ARP请求报文的时间间隔为3

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# arp retry-interval 3

相关命令

show interface

5.1.3arp timeout

命令功能

此命令设置动态ARP表项的老化时间。使用关键字no恢复老化时间为默认值。

命令语法

arp timeout SECONDS

no arp timeout

参数

参数说明

参数取值

SECONDS

ARP表项的老化时间,以秒为单位,范围<1-2147483>

1-2147483

命令模式

端口配置模式

默认配置

3600

使用说明

默认老化时间是3600秒;

此功能不能配置在2层端口上。

举例说明

设置动态ARP表项的老化时间为1200

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# arp timeout 1200

相关命令

show interface

5.1.4arp as-layer-3 enable

命令功能

此命令设置将arp报文当作三层报文处理。使用该命令的no形式来去使能arp报文当作三层处理。

命令语法

arp as-layer-3 enable

no arp as-layer-3 enable

命令模式

全局配置模式

默认配置

未使能

使用说明

vlan classifierIP Source Guard会收到此命令的影响。

使能时,vlan classifier使能基于iprule时,会将匹配src iparp报文也划分到指定vlan。否则arp报文不会被划分到指定vlan

使能时,ip source guard在端口上使能IP检查时,匹配src iparp报文不会被过滤。否则被过滤。

举例说明

设置将arp报文当作三层报文处理

Switch# configure terminal
Switch(config)# arp as-layer-3 enable

相关命令

N/A

5.1.5arp fake global enable

命令功能

此命令用于全局使能临时ARP。使用该命令的no形式来去使能临时arp

命令语法

arp fake global enable

no arp fake global enable

命令模式

全局配置模式

默认配置

未使能

使用说明

同时在全局使能和接口上使能才生效

举例说明

下面的例子在全局使能触发临时ARP表项

Switch# configure terminal
Switch(config)# arp fake global enable

相关命令

arp fake enable

5.1.6arp fake enable

命令功能

此命令用于在接口上使能临时ARP。使用该命令的no形式去使能端口临时arp

命令语法

arp fake enable

no arp fake enable

命令模式

端口配置模式

默认配置

使能

使用说明

使能后,本端口收到IP报文匹配不到对应的ARP 表项时,会下临时ARP表项。在收到ARP应答报文前,匹配临时ARP表项的IP报文将被丢弃并且不会上cpu触发ARP请求。在收到ARP应答报文后,则生成正确的ARP表项来替换临时ARP表项。未使能时,不会下临时ARP表项(不过show ip arp可以看到该临时ARP表项)

举例说明

下面的例子在端口上使能触发临时ARP表项

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# arp fake enable

相关命令

arp fake global enable

5.1.7arp fake timeout

命令功能

此命令用来配置临时ARP表项的老化时间。使用该命令的no形式恢复默认时间。

命令语法

arp fake timeout SECONDS

no arp fake timeout

参数

参数说明

参数取值

SECONDS

ARP临时表项的老化时间

1-36000, 单位:

命令模式

端口配置模式

默认配置

5

使用说明

当判断设备受到攻击时,可以执行本命令增大临时ARP表项的老化时间

举例说明

下面的例子设置临时ARP表项老化时间为100

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# arp fake timeout 100

相关命令

N/A

5.1.8clear arp-cache

命令功能

使用此命令更新ARP cache。使用此命令后,系统将探测ARP cache中的各项,探测失败的项将被清除。

命令语法

clear arp-cache ( ( vrf VRF-NAME | ) interface IFNAME | )

参数

参数说明

参数取值

vrf VRF-NAME

如果指定了此项,则更新此VRF内的ARP cache;如果没有指定此项,则更新公网内学习的ARP表项

不超过31个字符的字符串

IFNAME

如果指定了此项,则更新此端口的ARP cache;如果没有指定此项,则更新所有端口学习的ARP 表项

支持 physical/aggregation/loopback/vlan/tunnel 端口

命令模式

特权模式

默认配置

使用说明

此命令不能更新静态ARP表项。

举例说明

下面的例子描述了如何更新公网内所有动态ARP表项

Switch# clear arp-cache

相关命令

show ip arp

5.1.9clear ip arp

命令功能

使用此命令更新某个指定的动态ARP表项。使用此命令后,系统将探测这条ARP,若探测失败则该ARP被清除。

命令语法

clear ip arp ( vrf VRF-NAME | ) IP-ADDRESS

参数

参数说明

参数取值

vrf VRF-NAME

如果指定了此项,则更新此VRF内的ARP cache;如果没有指定此项,则更新公网内学习的ARP表项

不超过31个字符的字符串

IP-ADDRESS

更新指定的ARP表项

-

命令模式

特权模式

默认配置

使用说明

此命令用于更新指定IP地址的动态ARP表项。

举例说明

下面的例子描述了如何更新公网内的指定ARP表项

Switch# clear ip arp 10.10.10.10

相关命令

show ip arp

5.1.10clear ip arp statistics

命令功能

使用此命令清除ARP报文统计消息。

命令语法

clear ip arp ( vrf VRF-NAME | ) statistics

参数

参数说明

参数取值

vrf VRF-NAME

如果指定了此项,则清除此VRF内的ARP统计信息;如果没有指定此项,则清除公网内ARP统计信息

不超过31个字符的字符串

命令模式

特权模式

默认配置

使用说明

此命令用于清除ARP统计信息。

举例说明

下面的例子描述了如何清除ARP统计信息

Switch# clear ip arp statistics

相关命令

show ip arp summary

5.1.11show ip arp

命令功能

使用此命令查看所有ARP条目,包括动态的和静态的。

命令语法

show ip arp ( ( vrf VRF-NAME | ) interface INTERFACE-NAME | )

参数

参数说明

参数取值

vrf VRF-NAME|

如果指定了此项,则查看此VRF内的ARP cache;如果没有指定此项,则查看公网内学习的ARP表项

不超过31个字符的字符串

INTERFACE-NAME

如果指定了此项,则查看此端口的ARP cache;如果没有指定此项,则查看所有端口学习的ARP 表项

-

命令模式

特权模式

默认配置

使用说明

显示所有的ARP表项信息。

举例说明

下面的例子描述了如何查看公网内所有的ARP表项信息

Switch# show ip arp
Protocol    Address          Age (min)  Hardware Addr   Interface
Internet    1.1.1.1                 -   7cb5.0157.0c00  eth-0-1  
Internet    2.2.2.1                 -   7cb5.0157.0c00  eth-0-2  
Internet    3.3.3.1                 -   7cb5.0157.0c00  eth-0-3  
Internet    10.0.20.1               -   7cb5.0157.0c00  eth-0-10 
Internet    10.0.20.254             -   0000.5e00.0101  eth-0-10 

相关命令

clear ip arp

5.1.12show ip arp summary

命令功能

使用此命令查看ARP表项的统计信息。

命令语法

show ip arp ( vrf VRF-NAME | ) summary

参数

参数说明

参数取值

vrf VRF-NAME

VRF名称;如果指定了此项,则表示查看此VRF内的ARP表项统计信息;否则查看公网内的ARP表项统计信息

不超过31个字符的字符串

命令模式

特权模式

默认配置

使用说明

显示ARP表项的统计信息。

举例说明

下面的例子描述了如何查看公网内ARP表项的统计信息

Switch# show ip arp summary
Gratuitous ARP learning is disabled
2 IP ARP entries, with 0 of them incomplete
(Static:1,  Dyamic:0, Interface:1)
ARP Pkt Received is: 0
ARP Pkt Send number is: 1
ARP Pkt Dicard number is: 0

相关命令

clear ip arp statistics

5.1.13debug arp

命令功能

使用此命令打开ARP的调试开关,使用该命令的no形式关掉ARP调试。

命令语法

debug arp ( vrf VRF-NAME | )

参数

参数说明

参数取值

vrf VRF-NAME

VRF名称;如果指定了此项,则表示只打开此VRF内的ARP调试开关;否则打开公网内的ARP调试开关

不超过31个字符的字符串

命令模式

特权模式

默认配置

使用说明

打开ARP的调试开关,用户可以看到ARP报文的接收和发送信息,以及ARP表项的创建,更新和删除过程。

举例说明

下面的例子描述了如何打开ARP调试开关

Switch# debug arp
Sep  7 03:34:08 SWITCH ARP-7: IP ARP: creating entry for IP address: 7.7.7.7, hw: e64d.0445.df00
Sep  7 03:34:08 SWITCH ARP-7: IP ARP: send req src 7.7.7.7 e64d.0445.df00, dst 7.7.7.7 eth-0-1

相关命令

show debugging arp

5.1.14show debugging arp

命令功能

使用此命令查看ARP调试开关是否打开。

命令语法

show debugging arp ( vrf VRF-NAME | )

参数

参数说明

参数取值

vrf VRF-NAME

VRF名称;如果指定了此项,则表示只打开此VRF内的ARP调试开关;否则打开公网内的ARP调试开关

不超过31个字符的字符串

命令模式

特权模式

默认配置

使用说明

显示ARP调试开关是否打开。

举例说明

下面的例子描述了如何查看公网内ARP调试开关是否打开

Switch# show debugging arp
ARP debugging status:
  ARP packet debugging is on

相关命令

debug arp

5.1.15proxy-arp enable

命令功能

使用proxy-arp enable 命令用来开启代理ARP 功能。

使用该命令的no形式来关闭代理ARP 功能。

命令语法

proxy-arp enable ( virtual-mac-prefer | )

no proxy-arp enable

参数

参数说明

参数取值

(virtual-mac-prefer|)

使用virtual-router mac 地址回复ARP请求。默认情况下使用route-mac 地址回复ARP请求。

-

命令模式

端口配置模式

默认配置

缺省情况下,关闭ARP代理功能。

使用说明

ARP代理功能没有启用的时候,设备只会回复那些目的IP是设备自己的ARP请求报文。

举例说明

下面的例子显示了如何在端口eth-0-1上使能代理功能

Switch# configure terminal
Switch(config)#interface eth-0-1
Switch(config-if)#no switchport
Switch(config-if)#no shutdown
Switch(config-if)#ip address 1.1.1.1/24
Switch(config-if)# proxy-arp enable

相关命令

local-proxy-arp enable

5.1.16local-proxy-arp enable

命令功能

本地ARP代理功能使得3层设备可以回复那些目的IP和接收端口是同一个子网的ARP请求报文,无需通过路由。

使用local-proxy-arp enable 命令使能本地ARP代理功能,使用该命令的no形式关闭本地ARP代理功能。

命令语法

local-proxy-arp enable ( virtual-mac-prefer | )

no local-proxy-arp enable

参数

参数说明

参数取值

(virtual-mac-prefer|)

使用virtual-router mac 地址回复ARP请求。默认情况下使用route-mac 地址回复ARP请求。

-

命令模式

端口配置模式

默认配置

缺省情况下,本地ARP代理功能不使能。

使用说明

本地ARP代理最常见的应用场景是交换机或其下挂的交换机开启了二层端口隔离功能。使能本地ARP代理功能的时候,ICMP重定向功能被自动关闭。

举例说明

下面的例子显示了如何在端口eth-0-1上使能本地ARP代理功能

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# no shutdown
Switch(config-if)# ip address 1.1.1.1/24
Switch(config-if)# local-proxy-arp enable

相关命令

proxy-arp enable

5.1.17gratuitous-arp-learning enable

命令功能

使用命令gratuitous-arp-learning enable 来使能设备的免费ARP学习功能,使用该命令的no形式关闭免费ARP学习功能。

命令语法

gratuitous-arp-learning enable

no gratuitous-arp-learning enable

命令模式

全局配置模式

默认配置

缺省情况下,使能设备的免费ARP学习功能

使用说明

举例说明

下面的例子显示了如何使能免费ARP学习功能

Switch# configure terminal
Switch(config)# gratuitous-arp-learning enable

相关命令

show ip arp summary

5.1.18gratuitous-arp send interval

命令功能

使用该命令去配置gratuitous arp发送的间隔时间,使用该命令的no形式去恢复默认值

命令语法

arp gratuitous-arp send interval SECONDS

no arp gratuitous-arp send interval

参数

参数说明

参数取值

SECONDS

gratuitous arp发送的间隔时间

1-86400

命令模式

端口配置模式

默认配置

60

使用说明

举例说明

下面的例子显示了如何配置端口eth-0-1发送免费ARP的间隔时间

Switch# configure terminal
Switch(config)#interface eth-0-1
Switch(config-if)#no switchport
Switch(config-if)#no shutdown
Switch(config-if)#ip address 1.1.1.1/24
Switch(config-if)#arp gratuitous-arp send interval 80

相关命令

arp gratuitous-arp send enable

5.1.19gratuitous-arp send enable

命令功能

使用该命令去使能接口发送gratuitous arp

命令语法

arp gratuitous-arp send enable

no arp gratuitous-arp send enable

命令模式

端口配置模式

默认配置

不使能

使用说明

举例说明

下面的例子显示了如何使能eth-0-1发送免费ARP

Switch# configure terminal
Switch(config)#interface eth-0-1
Switch(config-if)#no switchport
Switch(config-if)#no shutdown
Switch(config-if)#ip address 1.1.1.1/24
Switch(config-if)#arp gratuitous-arp send enable

相关命令

arp gratuitous-arp send interval

5.1.20gratuitous-arp-learning enable

命令功能

使用命令gratuitous-arp-learning enable 来使能设备的免费ARP学习功能,使用该命令的no形式关闭免费ARP学习功能。

命令语法

gratuitous-arp-learning enable

no gratuitous-arp-learning enable

命令模式

全局配置模式

默认配置

缺省情况下,关闭设备的免费ARP学习功能

使用说明

举例说明

下面的例子显示了如何使能端口eth-0-1上的免费ARP学习功能

Switch# configure terminal
Switch(config)# gratuitous-arp-learning enable

相关命令

show ip arp summary

5.1.21gratuitous-arp send interval

命令功能

使用该命令去配置gratuitous arp发送的间隔时间,使用该命令的no形式去恢复默认值

命令语法

arp gratuitous-arp send interval SECONDS

no arp gratuitous-arp send interval

参数

参数说明

参数取值

SECONDS

gratuitous arp发送的间隔时间

1-86400

命令模式

全局配置模式

默认配置

60

使用说明

举例说明

下面的例子显示了如何配置端口eth-0-1发送免费ARP的间隔时间

Switch# configure terminal
Switch(config)#interface eth-0-1
Switch(config-if)#no switchport
Switch(config-if)#no shutdown
Switch(config-if)#ip address 1.1.1.1/24
Switch(config-if)#arp gratuitous-arp send interval 80

相关命令

arp gratuitous-arp send enable

5.1.22arp host-route enable

命令功能

使用该命令开启ARP转化为主机路由并发布给路由协议,使用该命令的no形式恢复默认值

命令语法

arp host-route enable ( tag NUM | )

参数

参数说明

参数取值

NUM

route-map匹配路由信息使用的tag

<1-4294967295>

命令模式

端口配置模式

默认配置

缺省情况下,关闭ARP转化为主机路由的功能

使用说明

此命令用于将ARP转化为主机路由并重发布给路由协议。

目前仅支持BGP路由协议。

举例说明

下面的例子显示了如何使能端口eth-0-1上的ARP主机路由发布功能,并将其重发布到BGP协议中

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# no switchport
Switch(config-if)# arp host-route enable
Switch(config-if)# exit
Switch(config)# router bgp 200
Switch(config-router)# redistribute connected

相关命令

redisitribute connect

5.2DHCP Client 命令

5.2.1ip address dhcp

命令功能

使用此命令通过DHCP 获得ip地址。

使用此命令的no格式删除获得的ip地址,并取消DHCP client功能。

命令语法

ip address dhcp

no ip address dhcp

命令模式

端口配置模式

默认配置

没有启用DHCP client

使用说明

此命令在接口上启用DHCP client功能;如果接口处于打开状态, 则立即开始通过DHCP 获得ip地址。否则该接口的DHCP client功能处于挂起状态,在接口打开后,开始启用DHCP client;使用此命令的no格式,会释放获得的ip地址,并发送DHCP RELEASE消息。

举例说明

使用DHCP 获得ip地址

Switch# configure terminal
Switch(config-if)# ip address dhcp

取消DHCP client功能,并释放通过DHCP获得的ip地址

Switch# configure terminal
Switch(config-if)# no ip address dhcp

相关命令

dhcp client request

dhcp client client-id

dhcp client class-id

dhcp client lease

dhcp client hostname

management ip address dhcp

show dhcp client

5.2.2management ip address dhcp

命令功能

使用此命令在管理口上通过DHCP获得ip地址。

使用此命令的no格式删除获得的ip地址,并取消DHCP client功能。

命令语法

management ip address dhcp

no management ip address dhcp

命令模式

全局配置模式

默认配置

没有在管理口启用DHCP client

使用说明

此命令在管理口上启用DHCP client功能;使用此命令的no格式,会释放获得的ip地址,并发送DHCP RELEASE消息。

举例说明

使用DHCP 为管理口获得ip地址

Switch# configure terminal
Switch(config)# management ip address dhcp

取消管理口DHCP client功能,并释放通过DHCP获得的ip地址

Switch# configure terminal
Switch(config)# no management ip address dhcp

相关命令

show dhcp client

5.2.3dhcp client request

命令功能

使用此命令设置client通过DHCP获得指定的配置参数。使用此命令的no格式取消请求的参数。

命令语法

dhcp client request ( router | static-route | classless-static-route | classless-static-route-ms | tftp-server-address | dns-nameserver | domain-name | netbios-nameserver | vendor-specific )

no dhcp client request ( router | static-route | classless-static-route | classless-static-route-ms | tftp-server-address | dns-nameserver | domain-name | netbios-nameserver | vendor-specific )

参数

参数说明

参数取值

router

默认路由器选项 (3)

-

static-route

静态路由选项 (33)

-

classless-static-route

无类静态路由选项(121)

-

classless-static-route-ms

Microsoft 无类静态路由选项 (249)

-

tftp-server-address

TFTP 服务器ip地址选项 (150)

-

dns-nameserver

DNS 服务器选项 (6)

-

domain-name

域名选项 (15)

-

netbios-nameserver

Netbios 服务器选项 (44)

-

vendor-specific

厂商相关配置选项 (43)

-

命令模式

端口配置模式

默认配置

routerstatic-routeclassless-static-routeclassless-static-route-mstftp-server-address为默认请求。

使用说明

此命令向DHCP server请求指定的配置参数,可以分多次指定所需要的参数,也可以一次指定所有需要的参数。此命令需要在ip address dhcp之前执行,否则只有在下一条ip address dhcp命令后才会生效。选项33,121,249之间存在优先级关系:选项121优先于选项33和选项249,选项249优先于选项33

举例说明

取消DHCP client功能,并释放通过DHCP获得的ip地址。

Switch# configure terminal
Switch(config-if)# no management ip address dhcp

指定请求默认路由器

Switch# configure terminal
Switch(config-if)# dhcp client request router

取消默认路由器请求

Switch# configure terminal
Switch(config-if)# no dhcp client request router

指定请求TFTP 服务器ip地址和静态路由

Switch# configure terminal
Switch(config-if)# dhcp client request static-route tftp-server-address

相关命令

ip address dhcp

5.2.4dhcp client client-id

命令功能

使用此命令设置DHCP client ID, 作为DHCP client的标记。

使用此命令的no格式删除设置的client ID,并使用默认的client ID

命令语法

dhcp client client-id ( ascii WORD | hex HEX-STRING | IFVLAN | IFAGG | IFPHYSICAL )

no dhcp client client-id

参数

参数说明

参数取值

ascii

ascii格式

-

WORD

ascii字符串

长度不超过64个字符

hex

十六进制格式

-

HEX-STRING

十六进制字符串

长度不超过64个字符

IFVLAN

vlan接口名称

1-4094

IFAGG

agg接口名称

-

IFPHYSICAL

物理接口名称

-

命令模式

端口配置模式

默认配置

缺省采用格式“Switch-HWADDR-IFNAME”

使用说明

此命令需要在ip address dhcp之前执行,否则只有在下一条ip address dhcp命令后才会生效。

举例说明

设置DHCP client IDswitch-client

Switch# configure terminal
Switch(config-if)# dhcp client client-id ascii switch-client

删除设置的DHCP client ID

Switch# configure terminal
Switch(config-if)# no dhcp client client-id

相关命令

ip address dhcp

5.2.5dhcp client class-id

命令功能

使用此命令设置DHCP clientclass-id

使用此命令的no格式删除设置的class-id

命令语法

dhcp client class-id ( WORD | hex HEX-STRING )

no dhcp client class-id

参数

参数说明

参数取值

WORD

ascii 字符串

-

hex

十六进制

-

HEX-STRING

十六进制字符串

-

命令模式

端口配置模式

默认配置

使用说明

DHCP client使用class-id标记自己需要的配置参数类型。不同的厂商会定义自己的class-id标记自己的特殊配置,DHCP client通过class-idserver请求这些与厂商相关的配置参数。此命令需要在ip address dhcp之前执行,否则只有在下一条ip address dhcp命令后才会生效。

举例说明

指定DHCP client class-id

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp client class-id acsii switch

删除指定的class-id

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# no dhcp client class-id

相关命令

ip address dhcp

5.2.6dhcp client lease

命令功能

使用此命令设置DHCP client 期望获得的租期。

使用此命令的no格式取消设置的期望租期。

命令语法

dhcp client lease DAYS ( HOURS ( MINUTES | ) | ) | infinite )

no dhcp client lease

参数

参数说明

参数取值

DAYS

租期时间,单位为天

0-365

HOURS

租期时间,单位为小时

0-23

MINUTES

租期时间,单位为分

0-59

infinite

租期时间为永久

-

命令模式

端口配置模式

默认配置

使用说明

设置DHCP client期望获得的租期,DHCP server可以接受该租期,也可以忽略client的请求,分配自己设置的租期。此命令需要在ip address dhcp之前执行,否则只有在下一条ip address dhcp命令后才会生效。

举例说明

设置DHCP client期望租期为20分钟

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp client lease 0 0 20

删除设置的期望租期

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# no dhcp client lease

相关命令

ip address dhcp

5.2.7dhcp client hostname

命令功能

使用此命令设置在DHCP 报文中使用的主机名称。

使用此命令的no格式取消设置的主机名称。

命令语法

dhcp client hostname WORD

no dhcp client hostname

参数

参数说明

参数取值

WORD

主机名称

不超过256个字符的字符串

命令模式

端口配置模式

默认配置

默认使用系统主机名称。

使用说明

此命令设置DHCP报文中的主机名称。此命令需要在ip address dhcp之前执行,否则只有在下一条ip address dhcp命令后才会生效。

举例说明

设置DHCP报文中主机名称为switch

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp client hostname switch

删除设置的主机名称

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# no dhcp client hostname

相关命令

ip address dhcp

5.2.8dhcp client default-router distance

命令功能

使用此命令为从DHCP server获得的路由设置默认的路由器的距离。

使用此命令的no格式删除设置的默认路由器距离。

命令语法

dhcp client default-router distance METRIC

no dhcp client default-router distance

参数

参数说明

参数取值

METRIC

默认的路由器距离

1-255

命令模式

全局配置模式

默认配置

DHCP server获得的路由的路由器距离将被设置为默认值254

使用说明

举例说明

设置默认路由器距离为233

Switch# configure terminal
Switch(config)# dhcp client default-router distance 233

删除设置的默认路由器距离

Switch# configure terminal
Switch(config)# no dhcp client default-router distance

相关命令

ip address dhcp

5.2.9dhcp client broadcast-flag

命令功能

使用此命令在DHCP消息中设置broadcast flag

使用此命令的no格式删除broadcast flag

命令语法

dhcp client broadcast-flag

no dhcp client broadcast-flag

命令模式

全局配置模式

默认配置

默认在请求IP地址阶段的DHCP 消息中设置该标记。

使用说明

Broadcast flag表示DHCP client在获得IP 地址前不能接受单播IP报文,所以如果设置broadcast flag,则DHCP 服务器或 DHCP relay agent将会广播DHCP 消息到client所在的子网。

举例说明

设置broadcast flag

Switch# configure terminal
Switch(config)# dhcp client broadcast-flag

删除broadcast flag

Switch# configure terminal
Switch(config)# no dhcp client broadcast-flag

相关命令

ip address dhcp

5.2.10debug dhcp client

命令功能

使用此命令可以打开dhcp client的模块的调试功能。

使用此命令的no格式关闭调试功能。

命令语法

debug dhcp client ( events | error | dump | packet | all )

no debug dhcp client ( events | error | dump | packet | all )

参数

参数说明

参数取值

events

调试dhcp client事件信息

-

error

调试dhcp client错误信息

-

packet

调试dhcp client的数据包信息

-

dump

以十六进制调试dhcp client的数据包信息

-

all

上面提到的所有调试信息

-

命令模式

特权模式

默认配置

使用说明

使用“terminal monitor”打印消息

举例说明

使用如下命令,打开dhcp client的所有调试信息

Switch# debug dhcp client all

相关命令

terminal monitor

show logging buffer

5.2.11show dhcp client

命令功能

此命令显示DHCP client的工作状态。

命令语法

show dhcp client ( management | IFVLAN | IFAGG | IFPHYSICAL | ) ( verbose | )

参数

参数说明

参数取值

management

显示管理口的DHCP client工作状态

-

IFVLAN

vlan 接口名称

1-4094

IFAGG

agg接口名称

-

IFPHYSICAL

物理接口名称

-

verbose

详细信息

-

命令模式

特权模式

默认配置

使用说明

使用此命令查看一个或多个接口上DHCP client的工作状态,添加verbose查看详细信息。

举例说明

查看所有接口上DHCP client工作状态

Switch# show dhcp client verbose
DHCP client informations:
============================================================
vlan1 DHCP client information:
  Current state: SELECT
  Transaction ID: 0x3ac1c1c7
============================================================
eth-0-1 DHCP client information:
  Current state: SELECT
  Transaction ID: 0x2fd3f55b

相关命令

ip address dhcp

5.2.12show dhcp client statistics

命令功能

使用此命令查看DHCP client统计信息。

命令语法

show dhcp client statistics

命令模式

特权模式

默认配置

使用说明

此命令显示DHCP 消息的统计信息。

举例说明

查看DHCP 消息统计信息

Switch# show dhcp client statistics
DHCP client packet statistics:
============================================================
DHCP OFFERS    received: 0
DHCP ACKs      received: 0
DHCP NAKs      received: 0
DHCP Others    received: 0
DHCP DISCOVER      sent: 0
DHCP DECLINE       sent: 0
DHCP RELEASE       sent: 0
DHCP REQUEST       sent: 0
DHCP packet send failed: 0

相关命令

ip address dhcp

5.2.13clear dhcp client statistics

命令功能

使用此命令清除DHCP client 计数器。

命令语法

clear dhcp client statistics

命令模式

特权模式

默认配置

使用说明

此命令将DHCP client 消息计数器清零。

举例说明

DHCP client 消息计数器清零。

Switch# clear dhcp client statistics

相关命令

ip address dhcp

show dhcp client statistics

5.3DHCP Relay命令

5.3.1dhcp relay

命令功能

在全局配置模式下,使用dhcp relay命令来启用DHCP relay服务。

使用此命令的no格式关闭该项功能。

命令语法

dhcp relay

no dhcp relay

命令模式

全局配置模式

默认配置

默认情况下此功能未打开。

使用说明

在启用DHCP relay服务前,必需先使用dhcp service命令使能DHCP功能,DHCP relay功能要在系统使能DHCP功能后才生效。

举例说明

启用dhcp relay服务

Switch# configure terminal
Switch(config)# dhcp relay

相关命令

service dhcp

5.3.2dhcp-server (global)

命令功能

在全局模式下使用dhcp-server命令创建DHCP服务器组。

使用此命令的no格式,删除一个DHCP服务器组。

命令语法

dhcp-server NUMBER SERVER-LIST

no dhcp-server NUMBER ( SERVER-LIST | )

参数

参数说明

参数取值

NUMBER

DHCP服务器组的序号

1-16

SERVER-LIST

加入服务器组中的DHCP服务器的IP地址列表。

1-16

命令模式

全局配置模式

默认配置

使用说明

此命令用来创建远端DHCP服务器组。

举例说明

配置全局的DHCP服务器

Switch# configure terminal
Switch(config)# dhcp-server 1 1.1.1.1 2.2.2.2 3.3.3.3

相关命令

service dhcp

dhcp-server (interface)

5.3.3dhcp-server vrf

命令功能

在全局模式下指定DHCP服务器组所属的VRF实例。

使用此命令的no格式恢复默认值。

命令语法

dhcp-server NUMBER vrf NAME

no dhcp-server NUMBER vrf

参数

参数说明

参数取值

NUMBER

DHCP服务器组的序号

1-16

NAME

VRF实例名

长度不超过31的字符串

命令模式

全局配置模式

默认配置

使用说明

此命令用来指定远端DHCP服务器组所属VRF实例。

举例说明

配置DHCP服务器所属的VRF实例

Switch# configure terminal
Switch(config)# dhcp-server 1 vrf vpn1

相关命令

service dhcp

dhcp-server (interface)

5.3.4dhcp-server (interface)

命令功能

在端口配置模式下,使用dhcp-server命令将一个接口添加到一个DHCP服务器组中去。

使用此命令的no格式,将这个接口从DHCP服务器组中删除。

命令语法

dhcp-server NUMBER

no dhcp-server

参数

参数说明

参数取值

NUMBER

DHCP服务器组的序号

1-16

命令模式

端口配置模式

默认配置

使用说明

此命令用来将一个接口添加到一个DHCP服务器组中去。

举例说明

将接口加入DHCP服务器组

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp-server 1

相关命令

service dhcp

5.3.5dhcp relay information check

命令功能

在全局模式下,使用dhcp relay information check命令配置DHCP服务器对转发的BOOTREPLY消息进行中继代理信息验证。

使用此命令的no格式取消中继代理信息的验证。

命令语法

dhcp relay information check

no dhcp relay information check

命令模式

全局配置模式

默认配置

DHCP服务器对转发的BOOTREPLY消息检查中继信息。无效的信息会被丢弃。

使用说明

举例说明

配置DHCP服务器对转发的BOOTREPLY消息进行中继代理信息验证

Switch# configure terminal
Switch(config)# dhcp relay information check

相关命令

dhcp relay information option

5.3.6dhcp relay information option

命令功能

在全局模式下,使用dhcp relay information option命令,使能系统转发BOOTREQUEST消息到DHCP服务器时,插入Option82选项功能。使用此命令的no格式关闭该项功能。

命令语法

dhcp relay information option ( link-selection | server-id-override | vss-control | )

no dhcp relay information option ( link-selection | server-id-override | vss-control | )

参数

参数说明

参数取值

link-selection

使能在报文Option 82中插入link selection sub-option

-

server-id-override

使能在报文Option 82中插入server identifier override sub-option

-

vss-control

使能在报文Option 82中插入virtual subnet selection sub-option virtual subnet selection control sub-option

-

命令模式

全局配置模式

默认配置

默认情况下,不对DHCP报文插入Option82选项。

使用说明

该命令使能DHCP服务器检测用户发送的请求,在Option82选项中添加适当的内容。默认情况下,系统不对DHCP报文插入Option82选项。

dhcp relay information option命令默认会在报文中加入电路ID和远端ID,对于其他sub-option,需要另外手动指定。

举例说明

使能系统对DHCP报文插入Option82选项并打开link-selection

Switch# configure terminal
Switch(config)# dhcp relay information option
Switch(config)# dhcp relay information option link-selection

相关命令

dhcp relay information check

dhcp relay information policy

5.3.7dhcp relay information policy

命令功能

在全局模式下,使用dhcp relay information policy命令配置DHCP报文Option82选项转发策略。

使用此命令的no格式设置为默认的转发策略。

命令语法

dhcp relay information policy ( drop | keep | replace )

no dhcp relay information policy

参数

参数说明

参数取值

drop

Option82选项的报文直接丢弃

-

keep

Option82选项的报文原样转发

-

replace

替换原报文中的Option 82 选项,然后进行转发

-

命令模式

全局配置模式

默认配置

默认情况下,替换原报文中的Option 82 选项,然后进行转发。

使用说明

该条命令用于电缆接入路由器终端系统。一个DHCP中继代理可能收到从另一个DHCP中继代理处发送的含有Option82信息的DHCP报文。默认情况下,使用当前relayOption82替换原报文中的Option82选项,然后进行转发。

举例说明

设置带Option82选项的报文直接丢弃

Switch# configure terminal
Switch(config)# dhcp relay information policy drop

相关命令

dhcp relay information option

dhcp relay information policy

5.3.8dhcp relay information policy (interface)

命令功能

在端口配置模式下,使用dhcp relay information policy命令配置DHCP报文Option82选项转发策略。

使用此命令的no格式取消配置。

命令语法

dhcp relay information policy ( drop | keep | replace )

no dhcp relay information policy

参数

参数说明

参数取值

drop

Option82选项的报文直接丢弃

-

keep

Option82选项的报文原样转发

-

replace

替换原报文中的Option 82 选项,然后进行转发

-

命令模式

端口配置模式

默认配置

接口没有配置Option 82 策略。

使用说明

接口配置Option 82 策略后,使用接口策略处理报文中的Option82内容。如果接口没有配置,则按照全局策略处理。

举例说明

设置带Option82选项的报文直接丢弃

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp relay information policy drop

相关命令

dhcp relay information option

5.3.9dhcp relay information trust-all

命令功能

在全局模式下,使用dhcp relay information trust-all命令配置路由器上所有接口为DHCP中继代理信息选项的信任源接口。使用此命令的no格式将接口设置为默认配置。

命令语法

dhcp relay information trust-all

no dhcp relay information trust-all

命令模式

全局配置模式

默认配置

默认情况下,交换机上的所有接口都为不信任中继代理信息。

使用说明

默认情况下,如果在DHCP报文中的网关地址被设置为0.0.0.0并且该报文中已经包含Option82选项,DHCP中继代理会丢弃该报文。如果在全局配置了dhcp relay information trust-all命令,即使DHCP报文的网关地址被设置为全0DHCP中继代理也不会丢弃该DHCP报文。取而代之,收到的DHCP DISCOVER或者DHCP REQUEST报文会按照普通的DHCP中继操作被转发到命令dhcp-server所配置的地址。

举例说明

配置所有接口为DHCP中继代理信息选项的信任源接口

Switch# configure terminal
Switch(config)# dhcp relay information trust-all

相关命令

dhcp relay information trusted

5.3.10dhcp relay information trusted

命令功能

在端口配置模式下,使用命令配置某接口为DHCP中继代理信息选项的信任源接口。使用此命令的no格式将接口设置为默认配置。

命令语法

dhcp relay information trusted

no dhcp relay information trusted

命令模式

端口配置模式

默认配置

默认情况下,所有接口都为不信任中继代理信息。

使用说明

默认情况下,如果在DHCP报文中的网关地址被设置为0.0.0.0并且该报文中已经包含Option82选项,DHCP中继代理会丢弃该报文。如果在全局配置了dhcp relay information trust-all命令,即使DHCP报文的网关地址被设置为全0DHCP中继代理也不会丢弃该DHCP报文。取而代之,收到的DHCP DISCOVER或者DHCP REQUEST报文会按照普通的DHCP中继操作被转发到命令dhcp-server所配置的地址。

举例说明

配置某接口为DHCP中继代理信息选项的信任源接口

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp relay information trusted

相关命令

dhcp relay information trust-all

5.3.11dhcp relay gateway

命令功能

在端口配置模式下,使用命令配置DHCP报文中的中继地址字段。

使用此命令的no格式将接口设置为默认配置。

命令语法

dhcp relay gateway A.B.C.D

no dhcp relay gateway

命令模式

端口配置模式

默认配置

DHCP报文中携带默认中继地址。

使用说明

举例说明

配置DHCP报文中的中继地址为10.10.10.1

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp relay gateway 10.10.10.1

相关命令

dhcp-server (interface)

5.3.12dhcp relay source-ip

命令功能

在端口配置模式下,使用命令配置DHCP中继代理的源地址。

使用此命令的no格式恢复DHCP中继代理的源地址为默认值。

命令语法

dhcp relay source-ip SRC_ADDR

no dhcp relay source-ip

参数

参数说明

参数取值

SRC_ADDR

指定源IP 地址

IPv4地址

命令模式

端口配置模式

默认配置

中继代理的默认源地址是DHCP报文出接口的主IP地址。

使用说明

此命令与dhcp relay source-interface互斥,不能同时配置

举例说明

配置DHCP报文中的源地址为10.10.10.1

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp relay source-ip 10.10.10.1

相关命令

dhcp relay source-interface

5.3.13dhcp relay source-interface

命令功能

在端口配置模式下,使用命令配置接口地址作为报文源IP地址。

使用此命令的no格式恢复默认值。

命令语法

dhcp relay source-interface IFNAME

no dhcp relay source-interface

参数

参数说明

参数取值

IFNAME

指定源接口名称

支持 physical/aggregation/sub-interface/loopback/vlan端口

命令模式

端口配置模式

默认配置

未配置接口地址作为报文源地址。

使用说明

此命令与dhcp relay source-ip互斥,不能同时配置

举例说明

配置DHCP报文中的源接口为loopback0

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp relay source-interface loopback0

相关命令

dhcp relay source-ip

5.3.14dhcp relay address cycle

命令功能

dhcp relay address cycle 命令用来使能DHCP中继的轮询功能。

no dhcp relay address cycle命令用来去使能DHCP中继的轮询功能。

命令语法

dhcp relay address cycle

no dhcp relay address cycle

命令模式

全局配置模式

默认配置

DHCP报文中继轮询功能默认不使能。

使用说明

此命令应用于DHCP中继。当DHCP中继上配置多个DHCP服务器的IP地址时,DHCP中继默认向所有的服务器转发DHCP DISCOVER报文,这样会造成服务器处理报文过多,给服务器带来压力。为解决此问题,可以配置此命令,使 DHCP中继收到DHCP DISCOVER报文后,每次只向一个服务器转发,并且每收到一次DHCP DISCOVER报文切换一个服务器,使多个服务器分配出去的IP地址数量持平,达到DHCP服务器之间负载均衡的效果。

举例说明

使能DHCP报文中继轮询功能

Switch# configure terminal
Switch(config)# dhcp relay address cycle

相关命令

5.3.15service dhcp

命令功能

在全局模式下,使用命令service dhcp enable使能DHCP snooping和中继代理功能。

使用service dhcp disabl关闭DHCP snooping和中继代理功能。

命令语法

service dhcp enable

service dhcp disable

命令模式

全局配置模式

默认配置

DHCP 服务缺省处于去使能状态。

使用说明

只有在用service dhcp命令总开关使能了DHCP服务,dhcp snoopingdhcp relaydhcp serverDHCP功能才会生效。

举例说明

配置全局使能DHCP功能

Switch# configure terminal
Switch(config)# service dhcp enable

配置全局关闭DHCP功能

Switch# configure terminal
Switch(config)# service dhcp disable

相关命令

dhcp relay

dhcp snooping

5.3.16debug dhcp relay

命令功能

使用此命令可以打开dhcp relay的模块的调试功能。

在原命令之前加上关键字“no”,关闭调试功能。

命令语法

debug dhcp relay ( events | error | dump | packet | all )

no debug dhcp relay ( events | error | dump | packet | all )

参数

参数说明

参数取值

events

调试dhcp relay事件信息

-

error

调试dhcp relay错误信息

-

packet

调试dhcp relay的数据包信息

-

dump

以十六进制调试dhcp relay的数据包信息

-

all

上面提到的所有调试信息

-

命令模式

特权模式

默认配置

使用说明

使用“terminal monitor”打印消息

举例说明

使用如下命令,打开dhcp relay的所有调试信息。

Switch# debug dhcp relay all

相关命令

terminal monitor

show logging buffer

5.3.17show dhcp-server

命令功能

在特权模式下,使用show dhcp-server命令查看DHCP服务器组的配置信息。

命令语法

show dhcp-server

命令模式

特权模式

默认配置

使用说明

该命令用于显示全局模式下使用dhcp-server命令配置的所有DHCP服务器组。

举例说明

在特权模式下使用 show dhcp-server 命令

Switch# show dhcp-server
DHCP server group information:
============================================================
group 1 ip address list:
    [1] 1.1.1.1
    [2] 2.2.2.2
    [3] 3.3.3.3
    [4] 4.4.4.4
    [5] 5.5.5.5
    [6] 6.6.6.6
    [7] 7.7.7.7
    [8] 8.8.8.8

相关命令

dhcp-server (global)

5.3.18show dhcp relay interfaces

命令功能

在特权模式下,使用show dhcp relay interfaces命令显示DHCP服务器组下的接口属性。

命令语法

show dhcp relay interfaces

命令模式

特权模式

默认配置

使用说明

该命令用于显示属于DHCP中继的接口信息。

举例说明

在特权模式下使用show dhcp relay interfaces 命令

Switch# show dhcp relay interfaces
List of DHCP relay enabled interface(s):
DHCP relay service status: enabled
Interface Name          DHCP server group
============================================================
eth-0-1                   1

相关命令

show dhcp-server

5.3.19show dhcp relay information config

命令功能

在特权模式下,使用show dhcp relay information config命令显示DHCP中继信息(Option82选项)配置信息。

命令语法

show dhcp relay information config

命令模式

特权模式

默认配置

使用说明

该命令用于显示DHCP中继的配置信息。

举例说明

在特权模式下使用show dhcp relay information config命令

Switch# show dhcp relay information config
DHCP relay agent information configuration:
============================================================
no dhcp relay information option
dhcp relay information check
dhcp relay information policy keep

相关命令

dhcp relay information option

5.3.20show dhcp relay information trusted-sources

命令功能

在特权模式下,使用show dhcp relay information trusted-sources命令显示所有接口是否配置为DHCP中继信息选项的信任源信息。

命令语法

show dhcp relay information trusted-sources

命令模式

特权模式

默认配置

使用说明

该命令用于显示所有接口被设置为DHCP中继的信任源。

举例说明

特权模式下使用show dhcp relay information trusted-sources命令

Switch# show dhcp relay information trusted-sources
List of trusted sources of relay agent information option:
============================================================
All interfaces are trusted source of relay agent information option

相关命令

dhcp relay information trusted

5.3.21show dhcp relay statistics

命令功能

在特权模式下,使用show dhcp relay statistics命令显示交换机中继的DHCP报文统计信息。

命令语法

show dhcp relay statistics

命令模式

特权模式

默认配置

使用说明

该命令用于显示交换机处理的DHCP统计的详情。

举例说明

在特权模式下使用show dhcp relay statistics命令

Switch# show dhcp relay statistics
DHCP relay packet statistics:
============================================================
Client relayed packets:  101
Server relayed packets:  88
Client error packets:    0
Server error packets:    0
Bogus GIADDR drops:      15
Bad circuit ID packets:  0
Corrupted agent options: 0
Missing agent options:   0
Missing circuit IDs:     0

相关命令

clear dhcp relay statistics

5.3.22clear dhcp relay statistics

命令功能

在特权模式下,使用clear dhcp relay statistics命令清除交换机中继的DHCP报文统计信息。

命令语法

clear dhcp relay statistics

命令模式

特权模式

默认配置

使用说明

该命令用于清除交换机处理的DHCP统计的详情。

举例说明

在特权模式下使用clear dhcp relay statistics命令

Switch# clear dhcp relay statistics

相关命令

show dhcp relay statistics

5.3.23dhcp relay information option format circuit-id

命令功能

在全局配置模式下使用该命令配置Option82选项中的电路ID格式。使用命令相应的no形式设置为默认电路ID

命令语法

dhcp relay information option format circuit-id { ifname | hostname | mac | string STRING }

no dhcp relay information option format circuit-id

参数

参数说明

参数取值

mac

端口MAC地址

-

STRING

ASCII 字符串

不超过63ASCII码的字符串

hostname

交换机的主机名

-

ifname

端口名字

-

命令模式

全局配置模式

默认配置

使用说明

必需在全局使能DHCP relay,才可以使DHCP relay的配置生效。

举例说明

全局配置circuit-id格式为ifnamemachostname

Switch# configure terminal
Switch(config)# dhcp relay information option format circuit-id ifname mac hostname
Switch(config)#

相关命令

5.3.24dhcp relay information option format circuit-id

命令功能

在端口配置模式下使用该命令配置Option82选项中的电路ID格式。使用命令相应的no形式设置为默认电路ID

命令语法

dhcp relay information option format circuit-id { ifname | hostname | mac | string STRING }

no dhcp relay information option format circuit-id

参数

参数说明

参数取值

mac

端口MAC地址

-

STRING

ASCII 字符串

不超过63ASCII码的字符串

hostname

交换机的主机名

-

ifname

端口名字

-

命令模式

端口配置模式

默认配置

使用说明

必需在全局使能DHCP relay,才可以使DHCP relay的配置生效。

举例说明

端口配置circuit-id格式为ifnamemac加自定义string

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp relay information option circuit-id format ifname string abc123

相关命令

5.3.25dhcp relay information option format remote-id (global)

命令功能

在全局配置模式下使用该命令配置Option82选项中的远端ID格式。使用命令相应的no形式设置为默认电路ID

命令语法

dhcp relay information option format remote-id { ifname | hostname | mac | string STRING }

no dhcp relay information option format remote-id

参数

参数说明

参数取值

mac

端口MAC地址

-

STRING

ASCII 字符串

不超过63ASCII码的字符串

hostname

交换机的主机名

-

ifname

端口名字

-

命令模式

全局配置模式

默认配置

使用说明

必需在全局使能DHCP relay,才可以使DHCP relay的配置生效。

举例说明

全局配置remote-id的格式为ifnamemachostname

Switch# configure terminal
Switch(config)# dhcp relay information option format remote-id ifname mac hostname
Switch(config)#

相关命令

5.3.26dhcp relay information option format remote-id (inteface)

命令功能

在端口配置模式下使用该命令配置Option82选项中的远端ID格式。使用命令相应的no形式设置为默认远端ID

命令语法

dhcp relay information option format remote-id { ifname | hostname | mac | string STRING }

no dhcp relay information option format remote-id

参数

参数说明

参数取值

mac

端口MAC地址

-

STRING

ASCII 字符串

不超过63ASCII码的字符串

hostname

交换机的主机名

-

ifname

端口名字

-

命令模式

端口配置模式

默认配置

使用说明

必需在全局使能DHCP relay,才可以使DHCP relay的配置生效。

举例说明

端口配置remote-id的格式为ifnamemac加自定义string

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp relay information option remote-id format ifname string abc123

相关命令

5.3.27dhcp relay information option format link-selection

命令功能

在端口配置模式下使用该命令配置Option82选项中的Link-selection格式。使用命令相应的no形式设置为默认远端ID

命令语法

dhcp relay information option format link-selection A.B.C.D

no dhcp relay information option format link-selection

命令模式

端口配置模式

默认配置

默认使用接口主地址

使用说明

必需在全局使能DHCP relay,才可以使DHCP relay的配置生效。

举例说明

端口配置link-selection的地址为10.1.1.1

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp relay information option link-selection 10.1.1.1

相关命令

5.4DHCP Server命令

5.4.1service dhcp

命令功能

service dhcp enable 命令用来使能DHCP snooping, server relay 功能。

service dhcp disable 命令用来关闭DHCP snooping, server relay 功能。

命令语法

service dhcp enable

service dhcp disable

命令模式

全局配置模式

默认配置

默认情况下DHCP服务关闭。

使用说明

只有在用service dhcp命令总开关使能了DHCP服务,dhcp snoopingdhcp relayDHCP功能才会生效。

举例说明

配置全局使能DHCP功能

Switch# configure terminal
Switch(config)# service dhcp enable

配置全局关闭DHCP功能

Switch# configure terminal
Switch(config)# service dhcp disable

相关命令

dhcp server

dhcp relay

dhcp snooping

5.4.2dhcp-server (global)

命令功能

dhcp server 命令用来使能 DHCP server功能。

no dhcp server 命令用来关闭DHCP server功能。

命令语法

dhcp server

no dhcp server

命令模式

全局配置模式

默认配置

默认情况下DHCP server 处于关闭状态

使用说明

在使能DHCP server功能前,必需先使用dhcp service命令使能DHCP功能,DHCP server功能要在系统使能DHCP功能后才生效。

举例说明

配置全局使能DHCP server功能

Switch# configure terminal
Switch(config)# dhcp server

相关命令

service dhcp

dhcp-server (interface)

5.4.3dhcp-server (interface)

命令功能

dhcp server enable 命令用来在接口上启用DHCP server功能。

dhcp server disable 命令用来在接口上关闭DHCP server功能。

命令语法

dhcp server enable

dhcp server disable

参数

参数说明

参数取值

enable

使能接口的DHCP server 功能

-

disable

去使能接口的DHCP server功能

-

命令模式

端口配置模式

默认配置

默认情况下接口上的DHCP server DHCP relay 模式都处于关闭状态。

使用说明

这个命令用来在三层端口上是能DHCP server 功能。

举例说明

配置端口使能DHCP server功能

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp server enable

相关命令

service dhcp

dhcp server(global)

5.4.4dhcp server subscriber-id interface-name

命令功能

dhcp server subscriber-id interface-name 命令用来使能将Subscriber ID定义为接口名功能。

no dhcp server subscriber-id interface-name 命令用来关闭将Subscriber ID定义为接口名功能。

命令语法

dhcp server subscriber-id interface-name

no dhcp server subscriber-id interface-name

命令模式

全局配置模式

默认配置

默认情况下将Subscriber ID定义为接口名功能处于关闭状态。

使用说明

DHCP服务器上开启Subscriber ID替换Client ID功能后,只有通过本命令将Subscriber ID定义为接口名,DHCP服务器才能在收到DHCP请求报文后根据接口名来分配地址,从而保证从该接口接入的客户端均使用同一IP地址。

举例说明

配置全局使能将Subscriber ID定义为接口名功能

Switch# configure terminal
Switch(config)# dhcp server subscriber-id interface-name

配置全局关闭将Subscriber ID定义为接口名功能

Switch# configure terminal
Switch(config)# no dhcp server subscriber-id interface-name

相关命令

dhcp server use subscriber-id client-id global (global)

dhcp server use subscriber-id client-id (interface)

5.4.5dhcp server use subscriber-id client-id global (global)

命令功能

dhcp server use subscriber-id client-id global 命令用来全局开启Subscriber ID替换Client ID功能。

no dhcp server use subscriber-id client-id global 命令用来全局关闭Subscriber ID替换Client ID功能。

命令语法

dhcp server use subscriber-id client-id global

no dhcp server use subscriber-id client-id global

命令模式

全局配置模式

默认配置

默认情况下全局Subscriber ID替换Client ID功能处于关闭状态。

使用说明

必须先执行dhcp server subscriber-id interface-name命令将Subscriber ID定义为接口名,否则本功能不会生效。

举例说明

配置全局使能Subscriber ID替换Client ID功能

Switch# configure terminal
Switch(config)# dhcp server use subscriber-id client-id global

配置全局关闭Subscriber ID替换Client ID功能

Switch# configure terminal
Switch(config)# no dhcp server use subscriber-id client-id global

相关命令

dhcp server subscriber-id interface-name

dhcp server use subscriber-id client-id (interface)

5.4.6dhcp server use subscriber-id client-id (interface)

命令功能

dhcp server use subscriber-id client-id命令用来在端口模式下开启Subscriber ID替换Client ID功能。

no dhcp server use subscriber-id client-id 命令用来在端口模式下关闭Subscriber ID替换Client ID功能。

命令语法

dhcp server use subscriber-id client-id

no dhcp server use subscriber-id client-id

命令模式

端口配置模式

默认配置

默认情况下端口上Subscriber ID替换Client ID功能处于关闭状态。

使用说明

必须先执行dhcp server subscriber-id interface-name命令将Subscriber ID定义为接口名,否则本功能不会生效。

举例说明

配置端口使能Subscriber ID替换Client ID功能

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# dhcp server use subscriber-id client-id

配置端口关闭Subscriber ID替换Client ID功能

Switch# configure terminal
Switch(config)# interface eth-0-1
Switch(config-if)# no dhcp server use subscriber-id client-id

相关命令

dhcp server subscriber-id interface-name

dhcp server use subscriber-id client-id global

5.4.7dhcp ping packets

命令功能

在全局模式下使用dhcp ping packets 命令配置在分配地址前需要发出ping的包的个数。使用命令相关的no形式恢复默认值。

命令语法

dhcp ping packets NUMBER

no dhcp ping packets

参数

参数说明

参数取值

NUMBER

需要设置的ping 发出的包个数

0-10

命令模式

全局配置模式

默认配置

默认在ping的时候发出1ICMP消息。

使用说明

DHCP server 在分配地址之前会ping所要分配的地址。使用该命令指定ping发出的包的个数,如果这些包都没有回应,则将地址分配给DHCP client, 否则不回应。

举例说明

配置ping发出的包的个数为10

Switch# configure terminal
Switch(config)# dhcp ping packets 10

相关命令

service dhcp

dhcp ping timeout

5.4.8dhcp ping timeout

命令功能

在全局模式下,使用dhcp ping timeout 命令配置ping超时时间。使用命令相关的no 形式恢复默认值。

命令语法

dhcp ping timeout NUMBER

no dhcp ping timeout

参数

参数说明

参数取值

NUMBER

设置ping超时的时间,单位秒(s)。

1-10

命令模式

全局配置模式

默认配置

默认ping的超时等待时间为1秒。

使用说明

DHCP server 在分配地址前会ping该地址,并等待该命令指定的时间。如果在指定时间内没有回应,则认为该地址没有被使用。

举例说明

配置dhcp ping超时时间为3

Switch# configure terminal
Switch(config)# dhcp ping timeout 3

相关命令

service dhcp

dhcp ping packets

5.4.9dhcp pool

命令功能

在全局模式下,使用dhcp pool 命令创建DHCP地址池,并进入DHCP地址池配置模式。

使用命令相关的no形式删除创建的DHCP地址池。

命令语法

dhcp pool WORD

no dhcp pool WORD

参数

参数说明

参数取值

WORD

DHCP 地址池名称

1) 名称长度范围 [1, 32)
2) 名称合法的字符 [0-9a-zA-Z.-_]
3) 名称必须以字母开头,字母或数字结束

命令模式

全局配置模式

默认配置

默认系统中没有DHCP 地址池。

使用说明

命令执行中,系统会从全局模式进入DHCP地址池配置模式,显示 ” (config-dhcp)# “。 在DHCP地址池配置模式下,可以配置地址池的参数,例如,可分配的子网地址段,默认网关等。

举例说明

创建DHCP 地址池pool1

Switch# configure terminal
Switch(config)# dhcp pool pool1

相关命令

service dhcp

dhcp select

static-bind

dhcp excluded-address

network (DHCP)

5.4.10address

命令功能

DHCP地址池配置模式下,使用address命令配置预留地址绑定。使用此命令的no格式,删除该地址的预留绑定。

命令语法

address IP_ADDR ( mac-address MAC_ADDR | client-identifier ( ascii WORD | hex HEX_STRING ) )

no address IP_ADDR

参数

参数说明

参数取值

IP_ADDR

ip 地址

IPv4地址

mac-address MAC_ADDR

DHCP clientmac地址

MAC地址

ascii WORD

ascii 形式的client id

长度不超过255个字符

hex HEX_STRING

hex string 形式的client id

长度不超过254个字符

命令模式

DHCP地址池配置模式

默认配置

默认DHCP地址池中没有预留绑定的地址。

使用说明

该命令需要在DHCP动态地址池中配置。

举例说明

配置预留绑定地址

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# network 1.1.1.0/24
Switch(config-dhcp)# address 1.1.1.2 mac-address 0012.24e0.8e00

配置删除预留绑定地址

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# no address 1.1.1.2

相关命令

dhcp pool

network (DHCP)

5.4.11static-bind

命令功能

DHCP地址池配置模式下,使用static-bind 命令配置静态绑定的地址。使用此命令的no格式,删除该地址的静态绑定。

命令语法

static-bind ip-address IP_ADDR/IP_MASK_LEN ( mac-address MAC_ADDR | client-identifier ( ascii WORD | hex HEX_STRING ) )

static-bind ip-address IP_ADDR IP_ADDR_MASK ( mac-address MAC_ADDR | client-identifier ( ascii WORD | hex HEX_STRING ) )

no static-bind

参数

参数说明

参数取值

IP_ADDR

ip 地址

IPv4地址

IP_ADDR_MASK

掩码

IPv4地址

IP_MASK_LEN

掩码位数

1-32

mac-address MAC_ADDR

DHCP clientmac地址

MAC地址

ascii WORD

ascii 形式的client id

长度不超过255个字符

hex HEX_STRING

hex string 形式的client id

长度不超过254个字符

命令模式

DHCP地址池配置模式

默认配置

默认DHCP地址池中没有静态绑定的地址。

使用说明

该命令会使当前DHCP地址池成为静态地址池。每个静态地址池中,只能配置一条静态绑定地址。

举例说明

配置静态绑定的地址

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# static-bind ip 10.10.10.10/24 mac-address 0012.2222.2222

相关命令

dhcp pool

5.4.12dns-server address

命令功能

DHCP 地址池配置模式下,使用dns-server命令配置DNS 服务器IP地址。使用此命令的no格式删除配置的服务器地址。

命令语法

dns-server A.B.C.D ( A.B.C.D… A.B.C.D )

no dns-server

参数

参数说明

参数取值

A.B.C.D

DNS 服务器IP地址(至少配置一个)

IPv4地址

A.B.C.D… A.B.C.D (Optional)

最多配置8个地址

IPv4地址

命令模式

DHCP地址池配置模式

默认配置

默认DHCP地址池没有配置DNS服务器地址。

使用说明

最多可以配置8DNS服务器地址。

举例说明

配置DNS服务器地址

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)#  dns-server 1.1.1.1 2.2.2.2

相关命令

dhcp pool

5.4.13domain-name

命令功能

DHCP 地址池配置模式下,使用domain-name命令配置域名。使用此命令的no格式删除配置的域名。

命令语法

domain-name WORD

no domain-name

参数

参数说明

参数取值

WORD

DHCP 客户端使用的域名前缀。


1) 名称长度范围 [1, 64)
2) 名称合法的字符 [0-9a-zA-Z.-_],
DHCP 客户端使用的域名前缀。
1) 名称长度范围 [1, 64)
2) 名称合法的字符 [0-9a-zA-Z.-_],
3) 名称必须以字母开头,字母或数字结束

命令模式

DHCP地址池配置模式

默认配置

默认DHCP地址池没有配置域名。

使用说明

通过设置域名前缀,DHCP客户端只需要输入部分域名,系统会自动添加设置的域名前缀。

举例说明

配置DHCP地址池的域名

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)#  domain-name switch.org

相关命令

dhcp pool

5.4.14bootfile-name

命令功能

DHCP地址池配置模式下,使用bootfile-name命令配置DHCP客户端需要的启动镜像文件名。使用此命令的no格式删除配置的启动文件名。

命令语法

bootfile-name WORD

no bootfile-name

参数

参数说明

参数取值

WORD

配置的启动文件的文件名.

1) 名称长度范围[1, 64)
2) 名称合法的字符[0-9a-zA-Z.-_],
配置的启动文件的文件名.
1) 名称长度范围[1, 64)
2) 名称合法的字符[0-9a-zA-Z.-_],
3) 名称必须以字母开头,字母或数字结束

命令模式

DHCP地址池配置模式

默认配置

默认没有配置启动文件名。

使用说明

通过配置地址池中的TFTP服务器地址和启动文件名称,DHCP客户端可以从TFTP服务器请求启动文件,完成自动配置。

举例说明

配置启动文件名称为dhclient_startup_config

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# bootfile dhclient_startup_config

相关命令

dhcp pool

tftp-server-address

5.4.15tftp-server-address

命令功能

在地址池配置模式下,使用命令tftp-server-address 配置TFTP 服务器地址。使用此命令的no格式删除配置。

命令语法

tftp-server-address A.B.C.D ( A.B.C.D… A.B.C.D )

no tftp-server-address

参数

参数说明

参数取值

A.B.C.D

IP地址

IPv4地址

A.B.C.D… A.B.C.D (Optional)

TFTP 服务器IP地址列表(最多可以设置8个)

IPv4地址

命令模式

DHCP地址池配置模式

默认配置

默认没有配置配置TFTP 服务器地址

使用说明

最多可以设置8TFTP 服务器地址。列表中地址按照先后顺序使用。

举例说明

配置TFTP 服务器地址为1.1.1.1,2.2.2.2

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# tftp-server-address1.1.1.1 2.2.2.2

相关命令

dhcp pool

bootfile-name

5.4.16gateway address

命令功能

在地址池配置模式下,使用命令gateway 配置默认网关。使用此命令的no格式删除配置。

命令语法

gateway A.B.C.D ( A.B.C.D… A.B.C.D )

no gateway

参数

参数说明

参数取值

A.B.C.D

IP地址

IPv4地址

A.B.C.D… A.B.C.D (Optional)

IP地址列表(最多可以设置8个)

IPv4地址

命令模式

DHCP地址池配置模式

默认配置

默认没有配置默认网关

使用说明

默认网关需要和地址池中的地址在同一子网内。.最多可以设置8个默认网关地址。列表中地址按照先后顺序使用。

举例说明

配置默认网关为1.1.1.12.2.2.2

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# gateway 1.1.1.1 2.2.2.2

相关命令

dhcp pool

5.4.17netbios-name-server

命令功能

在地址池配置模式下,使用命令netbios-name-server 配置netbios 域名服务器。使用此命令的no格式删除配置。

命令语法

netbios-name-server A.B.C.D ( A.B.C.D… A.B.C.D )

no netbios-name-server

参数

参数说明

参数取值

A.B.C.D

IP地址

IPv4地址

A.B.C.D… A.B.C.D (Optional)

IP地址列表(最多可以设置8个)

IPv4地址

命令模式

DHCP地址池配置模式

默认配置

默认没有配置netbios 域名服务器

使用说明

最多可以设置8netbios 域名服务器地址。列表中地址按照先后顺序使用。

举例说明

配置netbios 域名服务器1.1.1.1 2.2.2.2

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# netbios-name-server 1.1.1.1 2.2.2.2

相关命令

dhcp pool

5.4.18netbios-node-type

命令功能

在地址池配置模式下,使用netbios-node-type 配置NetBIOS node type。使用此命令的no格式删除配置。

命令语法

netbios-node-type [ b-node | p-node | m-node | h-node ]

no netbios-node-type

参数

参数说明

参数取值

b-node

广播

-

p-node

点到点

-

m-node

混合的

-

h-node

混合的(推荐使用)

-

命令模式

DHCP地址池配置模式

默认配置

默认没有配置NetBIOS节点类型

使用说明

使用该命令配置地址池中NetBIOS node type参数。

举例说明

配置NetBIOS node typeh-node

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# netbios-node-type h-node

相关命令

dhcp pool

5.4.19network

命令功能

在地址池配置模式下,使用命令network 配置要分配的地址段。使用此命令的no格式删除配置。

命令语法

network [ ip-address wildcard-mask | ip-address/prefix-length ]

no network

参数

参数说明

参数取值

ip-address

IP地址

IPv4地址

wildcard-mask

IP地址掩码

IPv4地址

prefix-length

IP掩码长度

0-32

命令模式

DHCP地址池配置模式

默认配置

默认没有配置分配的地址段

使用说明

该命令配置地址池中可分配的地址段。所有的主机地址都是可分配的,可以使用命令dhcp excluded-address禁止分配其中的地址。 不同地址池的地址段不能有重叠,并且不能再配置静态绑定。

举例说明

配置分配的地址段为1.1.1.0/24

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# network 1.1.1.0/24

相关命令

dhcp pool

5.4.20lease

命令功能

在地址池配置模式下,使用命令lease 配置地址池中分配的地址的租约时间。使用此命令的no格式恢复默认配置。

命令语法

lease DAYS ( HOURS ( MINUTES | ) | )

no lease

参数

参数说明

参数取值

DAYS

设置租约时间的天数

0-365

HOURS (Optional)

设置租约时间的小时数。必须先指定天数以后才能配置小时数。

0-23小时

MINUTES (Optional)

设置租约时间的分钟数数。必须先指定天数和小时数以后才能配置分钟数。

0-59分钟

命令模式

DHCP地址池配置模式

默认配置

默认配置为1

使用说明

无。

举例说明

配置租约为2

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# lease 2

配置租约为12小时

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)#  lease 1 2

配置租约为30分钟

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# lease 0 0 30

相关命令

dhcp pool

5.4.21option

命令功能

DHCP地址池配置模式下,使用option命令配置DHCP选项。

使用此命令的no格式删除配置的DHCP选项。

命令语法

option { code [ ascii ascii-string | hex hex-string | ip-address ip-address ] }

no option [ code ]

参数

参数说明

参数取值

code

DHCP选项代码,不支持 配置的选项列表如下:3, 6, 15, 44, 46, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 67, 82 and 150

2-254

ascii-string

NVT ASCII 字符串

长度不超过255个字符

hex-string

十六进制字符串

长度不超过254个字符,长度不是偶数时会在字符串的前面自动补0

ip-address

IP地址

IPv4地址, 最多配置8IP地址,每个IP地址用空格分隔

命令模式

DHCP地址池配置模式

默认配置

默认没有DHCP选项被配置。

使用说明

DHCP 提供一个TCP/IP网络上的参数配置框架。不同的参数以DHCP选项的形式存储。当前的DHCP选项参考RFC 2131, Dynamic Host Configuration Protocol

已经有专门命令行的DHCP 选项以及DHCP server无需支持的选项不支持用option命令来配置,

不支持配置的raw option列表如下:3, 6, 15, 44, 46, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 67, 82 and 150

举例说明

配置代码为4DHCP选项

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)# option 4 ip-address 10.10.10.10 11.11.11.11

相关命令

dhcp pool

5.4.22dhcp excluded-address

命令功能

在全局模式下,使用dhcp excluded-address 命令配置禁止分配的地址段。使用此命令的no格式删除配置的禁止分配地址。

命令语法

dhcp excluded-address A.B.C.D [ A.B.C.D ]

no dhcp excluded-address A.B.C.D [ A.B.C.D ]

参数

参数说明

参数取值

A.B.C.D

起始的IP地址

IPv4地址

A.B.C.D(Optional)

(可选)结束的IP地址

IPv4地址

命令模式

全局配置模式

默认配置

所有地址池中的地址都可以分配。

使用说明

使用该命令选择地址池中禁止分配的地址。DHCP服务器在分配地址时,会检查该地址是否被禁用。

举例说明

配置禁止分配地址10.10.1.100 -10.10.1.199

Switch# configure terminal
Switch(config)# dhcp pool test
Switch(config-dhcp)#  ip dhcp excluded-address 10.10.1.100 10.10.1.199

相关命令

dhcp pool

5.4.23show dhcp server conflict

命令功能

在特权模式下,使用命令show dhcp server conflict 显示发现并记录的冲突地址。

命令语法

show dhcp server conflict [ ip A.B.C.D | all ]

参数

参数说明

参数取值

ip A.B.C.D

IP地址

IPv4地址

all

所有地址

-

命令模式

特权模式

默认配置

使用说明

DHCP服务器在分配地址之前,会检测地址是否已使用,并将冲突的地址记录下来。

举例说明

显示冲突的地址

Switch# show ip dhcp conflict all

相关命令

clear dhcp server conflict

dhcp ping packets

dhcp ping timeout

5.4.24show dhcp server binding

命令功能

在特权模式下,使用命令show dhcp server binding 显示DHCP服务器中绑定的地址信息。

命令语法

show dhcp server binding [ ip A.B.C.D | pool WORD | all ]

参数

参数说明

参数取值

ip A.B.C.D

IP地址

IPv4地址

pool WORD

地址池名称

长度不超过31个字符的字符串

all

所有地址

-

命令模式

特权模式

默认配置

使用说明

绑定地址的信息包括IP地址,MAC地址,租约时间,地址类型。

举例说明

显示DHCP服务器绑定地址信息

Switch# show ip dhcp binding 1.1.1.1

相关命令

clear dhcp server binding

5.4.25show dhcp server statistics

命令功能

在特权模式下,使用命令show dhcp server statistics 显示DHCP服务器统计。

命令语法

show dhcp server statistics

命令模式

特权模式

默认配置

使用说明

无。

举例说明

显示DHCP服务器统计

Switch#show dhcp server statistics
DHCP server packet statistics:
============================================================
Message Received
BOOTREQUEST         12
DHCPDISCOVER    200
DHCPREQUEST         178
DHCPDECLINE         0
DHCPRELEASE         0
DHCPINFORM      0
Message Sent
BOOTREPLY       12
DHCPOFFER       190
DHCPACK             172
DHCPNAK             6

相关命令

clear dhcp server statistics

5.4.26show dhcp server config

命令功能

在特权模式下,使用show dhcp server config 命令显示DHCP服务器配置。

命令语法

show dhcp server config

命令模式

特权模式

默认配置

使用说明

显示DHCP服务器配置。

举例说明

显示DHCP服务器配置

Switch# show dhcp server config
DHCP server configuration:
============================================================
Pool name: pool10
network 10.1.1.0 mask 255.255.255.0
gateway 10.1.1.1

相关命令

N/A

5.4.27clear dhcp server conflict

命令功能

在特权模式下,使用clear dhcp server conflict 命令清除记录的冲突地址。

命令语法

clear dhcp server conflict [ ip A.B.C.D | all ]

参数

参数说明

参数取值

ip A.B.C.D

IP地址

IPv4地址

all

所有地址

-

命令模式

特权模式

默认配置

使用说明

举例说明

清除地址 1.1.1.99

Switch# clear ip dhcp conflict 1.1.1.99

相关命令

show dhcp server conflict

5.4.28clear dhcp server binding

命令功能

在特权模式下,使用clear dhcp server binding DHCP服务器数据库中清除动态绑定的地址。

命令语法

clear dhcp server binding [ ip A.B.C.D | pool WORD | all ]

参数

参数说明

参数取值

ip A.B.C.D

IP地址

IPv4地址

pool WORD

地址池名字

长度不超过31个字符的字符串

all

所有地址

-

命令模式

特权模式

默认配置

使用说明

举例说明

清除地址绑定 1.1.1.99

Switch# clear ip dhcp binding 1.1.1.99

相关命令

show dhcp server binding

5.4.29clear dhcp server statistics

命令功能

在特权模式下,使用clear dhcp server statistics 命令清除DHCP服务器统计信息。

命令语法

clear dhcp server statistics

命令模式

特权模式

默认配置

使用说明

举例说明

清除DHCP服务器计数器

Switch# clear dhcp server statistics

相关命令

clear dhcp server statistics

5.4.30show dhcp server pool

命令功能

在特权模式下,使用show dhcp server pool 命令显示DHCP服务器pool资源使用情况统计信息。

命令语法

show dhcp server pool ( WORD | )

参数

参数说明

参数取值

WORD

地址池名字

长度不超过31个字符的字符串

命令模式

特权模式

默认配置

使用说明

举例说明

显示pool资源的使用情况

Switch# show dhcp server pool pool1
Pool                           : pool1
Type                           : Dynamic
Lease                          : 0 Days 0 Hours 5 Minutes
Total addresses                : 254
Leased addresses               : 1
Excluded addresses             : 1
Free addresses                 : 252
Conflict addresses             : 0
Current index        IP address range                    Leased/Excluded/Total
2.1.1.5              2.1.1.1         - 2.1.1.254          1    /1    /254 
============================================================

相关命令

5.5DNS命令

5.5.1ip host

命令功能

全局模式下使用 ip host 命令在域名系统(DNS)中设置主机名及其对应的ip地址。如果当前域名缓存中不存在此对应关系,系统会自动创建。

本命令的no格式用来删除主机名与ip地址的对应关系。

命令语法

ip host HOSTNAME IP_ADDR

no ip host hostname

参数

参数说明

参数取值

HOSTNAME

主机名

长度不超过63个字符的字符串

IP_ADDR

与主机名对应的ip地址

IPv4地址

命令模式

全局配置模式

默认配置

域名缓存中无静态配置的主机名及其对应的ip地址。

使用说明

举例说明

全局模式下,设置主机名及对应IP地址

Switch# configure terminal
Switch(config)# ip host www.example1.com 192.0.2.141

相关命令

show ip host

5.5.2dns domain

命令功能

全局模式下使用dns domain命令在域名系统(DNS)下设置一个缺省域名。

本命令的no格式用来删除指定的域名。

命令语法

dns domain DOMAIN-NAME

no dns domain DOMAIN-NAME

参数

参数说明

参数取值

DOMAIN-NAME

域名

长度不超过63个字符的字符串

命令模式

全局配置模式

默认配置

使用说明

举例说明

全局模式下,在域名系统中设置缺省域名

Switch# configure terminal
Switch(config)# dns domain www.example1.com

相关命令

show dns domain

5.5.3dns server

命令功能

全局模式下使用dns server命令在域名系统(DNS)的域名服务器列表中新增一个域名服务器。本命令的no格式用来从服务器列表中删除域名服务器。

命令语法

dns server IP_ADDR ( source-interface IFNAME | source-ip A.B.C.D | )

no dns server IP_ADDR

参数

参数说明

参数取值

IP_ADDR

域名服务器的ip地址

支持IPv4IPv6地址

IFNAME

指定源接口名称

支持 physical/aggregation/loopback/tunnel/vlan 端口

A.B.C.D

指定源IP地址

IPv4地址

命令模式

全局配置模式

默认配置

域名服务器列表中不存在域名服务器。

使用说明

本命令最多能添加三个域名解析服务器。如果指定源接口或者源IP地址,将会使用对应的IP地作为发出报文的源IP地址。

举例说明

全局模式下,新增域名服务器

Switch# configure terminal
Switch(config)# dns server 10.10.1.1
Switch(config)# dns server 20.20.2.2

相关命令

show dns server

5.5.4show dns

命令功能

特权模式下使用show dns命令显示域名系统(DNS)的配置信息。

命令语法

show dns { domain | server }

参数

参数说明

参数取值

domain

显示域名列表

-

server

显示域名服务器列表

-

命令模式

特权模式

默认配置

使用说明

举例说明

特权模式下,显示域名系统的配置信息

Switch# show dns domain
Current DNS domain configuration:
     Domain                 Suffix
----------------------------------------
1    domain                 domain.com
2    domain                 aa.com

相关命令

dns server

dns domain

5.5.5show ip host

命令功能

特权模式下,使用show ip host命令显示指定ip主机的配置信息。

命令语法

show ip host

命令模式

特权模式

默认配置

使用说明

举例说明

特权模式下,显示指定主机的配置信息

Switch# show ip host
Current IP host configuration:
     Host                           Address
--------------------------------------------------------------
1    www.sampledomain.com           1.1.1.1

相关命令

ip host