19-DHCP命令
本章节下载 (158.52 KB)
目 录
1.1.2 dhcp-snooping information enable
1.1.3 dhcp-snooping information format
1.1.4 dhcp-snooping information packet-format
1.1.5 dhcp-snooping information remote-id
1.1.6 dhcp-snooping information strategy
1.1.7 dhcp-snooping information vlan circuit-id
1.1.8 dhcp-snooping information vlan remote-id
1.1.11 display dhcp-snooping trust
1.1.12 display ip source static binding
1.1.13 ip check source ip-address
1.1.14 ip source static binding
【命令】
dhcp-snooping
undo
dhcp-snooping
【视图】
系统视图
【参数】
无
【描述】
dhcp-snooping命令用来开启交换机DHCP Snooping功能。undo dhcp-snooping命令用来关闭DHCP Snooping功能。
缺省情况下,交换机的DHCP Snooping功能处于关闭状态。
相关配置可参考命令display dhcp-snooping。
【举例】
# 进入系统视图。
<H3C> system-view
System View: return to User View with Ctrl+Z.
# 开启DHCP Snooping功能。
[H3C] dhcp-snooping
【命令】
dhcp-snooping information enable
undo
dhcp-snooping information enable
【视图】
系统视图
【参数】
无
【描述】
dhcp-snooping information enable命令用来开启DHCP Snooping支持Option 82功能。undo dhcp-snooping information enable命令用来关闭DHCP Snooping支持Option 82功能。
缺省情况下,DHCP Snooping支持Option 82功能处于关闭状态。
注意:
只有支持DHCP Snooping的设备配置了DHCP Snooping功能后,才支持此项配置。
【举例】
# 开启DHCP Snooping支持Option 82的功能。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] dhcp-snooping information enable
【命令】
dhcp-snooping information format { hex | ascii }
【视图】
系统视图
【参数】
hex:指定Option 82存储格式是HEX,即十六进制数串格式。
ascii:指定Option 82存储格式是ASCII(美国信息交换标准码)格式。
【描述】
dhcp-snooping information format命令用来配置DHCP Snooping支持Option 82的存储格式为HEX或ASCII格式。
缺省情况下,DHCP Snooping支持Option 82的存储格式为HEX。
& 说明:
dhcp-snooping information format命令只对交换机默认填加的Option 82内容生效。如果用户通过命令配置了Circuit ID或Remote ID的内容,则相应子选项的填充格式为ASCII格式,不再受dhcp-snooping information format命令配置的约束。
【举例】
#
配置Option 82的存储格式为ASCII格式。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] dhcp-snooping information format ascii
【命令】
dhcp-snooping information packet-format { extended | standard }
【视图】
系统视图
【参数】
extended:配置Option 82字段的填充格式为扩展格式。
standard:配置Option 82字段的填充格式为标准格式。
【描述】
dhcp-snooping information packet-format命令用来配置Option 82字段的填充格式为标准格式或扩展格式。
缺省情况下,Option 82字段的填充格式为扩展格式。
【举例】
# 配置Option 82字段的填充格式为标准格式。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] dhcp-snooping information packet-format standard
【命令】
dhcp-snooping information remote-id { sysname
| string string }
undo dhcp-snooping information remote-id
【视图】
系统视图
【参数】
sysname:用DHCP Snooping设备的系统名填充Option 82的Remote ID字段内容。
string:用户自定义配置的Remote ID子选项的内容,格式为ASCII字符串,取值范围为1~63个字符。
【描述】
dhcp-snooping information circuit-id命令用来配置Option 82的Remote ID内容。undo dhcp-snooping information circuit-id命令用来恢复Option 82的Remote ID内容的缺省值。
缺省情况下,Option 82中Remote ID内容为接收到DHCP客户端请求报文的DHCP Snooping设备的MAC地址。
【举例】
# 配置Option 82中Remote ID的内容为DHCP Snooping设备的系统名称。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] dhcp-snooping information remote-id sysname
【命令】
dhcp-snooping information strategy { drop | keep | replace }
undo
dhcp-snooping information strategy
【视图】
系统视图、以太网端口视图
【参数】
drop:如果报文中带有Option 82选项,则DHCP Snooping丢弃该报文。
keep:如果报文中带有Option 82选项,则DHCP Snooping保持该报文中的Option 82选项不变并进行转发。
replace:如果报文中带有Option 82选项,DHCP Snooping按照配置的填充内容填充Option 82选项,并替换报文中原有的Option 82选项进行转发。
【描述】
在系统视图下执行dhcp-snooping information strategy命令用来对所有端口接收的包含Option 82选项请求报文配置处理策略。undo dhcp-snooping information strategy命令用来恢复缺省的处理策略。
在以太网端口视图下执行dhcp-snooping information strategy命令用来对指定端口接收的包含Option 82选项请求报文配置处理策略。undo dhcp-snooping information strategy命令用来恢复缺省的处理策略。
缺省情况下,DHCP Snooping设备对DHCP客户端发送的带有Option 82选项的请求报文的处理策略为replace。
注意:
l 只有支持DHCP Snooping的设备开启DHCP Snooping功能以及支持Option 82功能后,才支持此项配置。
l 当同时配置了全局处理策略和指定端口的端口处理策略时,在该端口上优先使用端口处理策略进行处理,其它端口使用全局处理策略进行处理。
【举例】
# 配置DHCP Snooping设备对DHCP客户端发送的带有Option 82选项的请求报文使用keep策略。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] dhcp-snooping information strategy keep
【命令】
dhcp-snooping information [ vlan vlan-id ] circuit-id string string
undo dhcp-snooping information { [ vlan
vlan-id ] circuit-id | circuit-id all }
【视图】
以太网端口视图
【参数】
vlan vlan-id
:指定需要配置自定义Circuit ID内容的VLAN编号。
string:用户自定义配置的Circuit ID子选项的内容,格式为ASCII码字符串,取值范围为3~63个字符。
【描述】
dhcp-snooping information vlan circuit-id命令用来配置Option 82 的Circuit ID内容。undo dhcp-snooping information circuit-id命令用来恢复Option 82 的Circuit ID内容为缺省值。
如果选择参数vlan vlan-id,则对指定VLAN内的DHCP报文进行用户自定义Circuit ID子选项内容的配置;如果没有指定参数vlan vlan-id,则对所有经过当前端口的DHCP报文进行用户自定义Circuit ID子选项内容的配置。
undo dhcp-snooping information vlan
vlan-id circuit-id命令用来恢复指定VLAN的DHCP报文中Circuit ID的值为缺省情况。
undo dhcp-snooping information circuit-id用来恢复指定VLAN以外的所有DHCP报文中Circuit ID的值为缺省情况。
undo dhcp-snooping information circuit-id all命令用来恢复所有DHCP报文中Circuit ID的值为缺省情况。
缺省情况下,Option 82的Circuit ID内容为接收到DHCP客户端请求报文的端口所属VLAN的编号以及端口索引。
【举例】
# 配置Option 82的Circuit ID字段的内容为abc。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface GigabitEthernet1/0/1
[H3C-GigabitEthernet1/0/1] dhcp-snooping information circuit-id string abc
【命令】
dhcp-snooping information
[ vlan vlan-id ]
remote-id string string
undo dhcp-snooping information
{ [ vlan vlan-id ] remote-id
| remote-id all }
【视图】
以太网端口视图
【参数】
vlan vlan-id:指定需要配置Remote ID子选项的VLAN
编号。
string:用户自定义配置的Remote ID子选项的内容,格式为ASCII字符串,取值范围为3~63个字符。
【描述】
dhcp-snooping information vlan remote-id命令用来配置Option 82的Remote ID内容。undo dhcp-snooping information remote-id命令用来恢复Option 82 的Remote ID内容为缺省值。
如果选择参数vlan vlan-id,则对指定VLAN内的DHCP报文进行用户自定义Remote ID子选项内容的配置;如果没有指定参数vlan vlan-id,则对所有经过当前端口的DHCP报文进行用户自定义Remote ID子选项内容的配置。
undo dhcp-snooping information vlan vlan-id remote-id命令用来恢复指定VLAN的DHCP报文中Remote ID的值为缺省情况。
undo dhcp-snooping information remote-id用来恢复指定VLAN以外的所有DHCP报文中Remote ID的值为缺省情况。
undo dhcp-snooping information remote-id all命令用来恢复所有DHCP报文中Remote ID的值为缺省情况。
缺省情况下,Option 82的Remote ID内容为接收到DHCP客户端请求报文的DHCP Snooping设备的MAC地址。
【举例】
# 配置通过端口GigabitEthernet1/0/1的DHCP报文的Option 82字段中Remote ID的内容为abc。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface GigabitEthernet1/0/1
[H3C-GigabitEthernet1/0/1] dhcp-snooping information remote-id string abc
【命令】
dhcp-snooping trust
undo dhcp-snooping trust
【视图】
以太网端口视图
【参数】
无
【描述】
dhcp-snooping trust命令用来配置端口为DHCP Snooping信任端口。undo dhcp-snooping trust命令用来恢复端口为DHCP Snooping不信任端口。
缺省情况下,开启DHCP Snooping功能后,交换机的所有端口均为DHCP Snooping不信任端口。
相关配置可参考命令display dhcp-snooping trust。
【举例】
# 进入系统视图。
<H3C> system-view
System View: return to User View with Ctrl+Z.
# 配置端口GigabitEthernet1/0/1为信任端口。
[H3C-GigabitEthernet1/0/1] dhcp-snooping trust
【命令】
display
dhcp-snooping [ unit unit-id ]
【视图】
任意视图
【参数】
unit
unit-id:设备的Unit编号,取值为1。
【描述】
display
dhcp-snooping命令用来显示通过DHCP Snooping记录的用户IP地址和MAC地址的对应关系。
相关配置可参考命令dhcp-snooping。
【举例】
# 显示通过DHCP Snooping记录的用户IP地址和MAC地址信息。
DHCP-Snooping is enabled.
The client binding table for all untrusted ports.
Type : D--Dynamic , S--Static
Unit ID : 1
Type IP Address MAC Address Lease VLAN Interface
==== =============== =============== =========
==== =================
D 10.1.1.1 000f-e200-0006 200 1 GigabitEthernet1/0/1
--- 1 dhcp-snooping item(s) of unit 1 found ---
【命令】
display
dhcp-snooping trust
【视图】
任意视图
【参数】
无
【描述】
display
dhcp-snooping trust命令用来显示DHCP Snooping开启状态及信任端口信息。
相关配置可参考命令dhcp-snooping trust。
【举例】
# 显示DHCP Snooping开启状态及信任端口信息。
<H3C> display dhcp-snooping trust
DHCP-Snooping is enabled.
DHCP-Snooping trust become effective.
Interface
Trusted
===================== =================
GigabitEthernet1/0/10 Trusted
以上显示信息表示DHCP Snooping处于开启状态,DHCP Snooping信任功能生效,信任端口为GigabitEthernet 1/0/10。
【命令】
display ip source static binding [ vlan vlan-id | interface interface-type interface-number ]
【视图】
任意视图
【参数】
vlan-id:需要显示的VLAN编号。
interface-type interface-number:需要显示的端口,其中interface-type 为端口类型,interface-number为端口编号。
【描述】
display
ip source static binding命令用来显示用户配置的IP静态绑定表。当命令中指定vlan参数时,将显示指定VLAN的所有IP静态绑定表项;当命令中指定interface参数时,将显示指定端口的所有IP静态绑定表项。
【举例】
# 显示用户配置的所有IP静态绑定表项。
<H3C> display ip source static binding
Type IP Address MAC Address Remaining VLAN Interface
lease
==== =============== ===============
========= ==== =================
S 192.168.0.25 0015-e20f-0101 infinit 1 GigabitEthernet1/0/2
S 192.168.0.58 0001-e201-4f01 infinit 1 GigabitEthernet1/0/3
S 192.168.0.101 000f-0101-0204 infinit 1 GigabitEthernet1/0/2
S 192.168.0.122 000f-e20f-21a3 infinit 1 GigabitEthernet1/0/3
S 192.168.0.144 0015-e943-712f infinit 1 GigabitEthernet1/0/2
--- 5 static binding item(s)
found ---
【命令】
ip check source ip-address [ mac-address ]
undo
ip check source ip-address [ mac-address
]
【视图】
以太网端口视图
【参数】
无
【描述】
ip check source ip-address命令用来开启根据端口接收的IP报文的源IP地址对报文进行过滤的功能。undo ip check source ip-address命令用来关闭根据端口接收的IP报文的源IP地址对报文进行过滤功能。
ip check source ip-address mac-address命令用来开启根据端口接收的IP报文的源IP地址和源MAC地址对报文进行过滤的功能。undo ip check source ip-address mac-address命令用来关闭根据端口接收的IP报文的源IP地址和源MAC地址对报文进行过滤功能。
缺省情况下,对端口接收的IP报文的源IP地址或源IP地址和源MAC地址进行过滤的功能处于关闭状态。
【举例】
# 开启根据端口GigabitEthernet
1/0/11接收的IP报文的源IP地址对报文进行过滤的功能。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface GigabitEthernet 1/0/11
[H3C-GigabitEthernet1/0/11] ip check source ip-address
【命令】
ip source static binding ip-address ip-address [ mac-address
mac-address ]
undo ip source static binding ip-address ip-address
【视图】
以太网端口视图
【参数】
ip-address:要静态绑定的IP地址。
mac-address:要静态绑定的MAC地址。
【描述】
ip source static binding ip-address命令用来配置IP报文的源IP地址、源MAC地址与端口之间的静态绑定关系,形成静态绑定表项。undo ip source static binding ip-address命令用来取消设置的IP报文的源IP地址、源MAC地址与端口之间的静态绑定表项。
缺省情况下,没有设置IP报文的源IP地址、源MAC地址与端口之间的静态绑定关系。
【举例】
# 设置源IP地址、源MAC地址与以太网端口GigabitEthernet
1/0/3之间的静态绑定关系。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface GigabitEthernet 1/0/3
[H3C-GigabitEthernet1/0/3] ip source static binding ip-address 1.1.1.1 mac-address 0015-e20f-0101
【命令】
display
dhcp client [ verbose ]
【视图】
任意视图
【参数】
verbose:显示DHCP客户端的地址分配的详细信息。
【描述】
display
dhcp client命令用来显示DHCP客户端的地址分配信息。
需要注意的是:目前S5100-SI/EI系列以太网交换机作为DHCP客户端,可以支持的最大租约时间为24天。
【举例】
# 显示DHCP客户端的地址分配信息。
<H3C> display dhcp client verbose
DHCP client statistic infomation:
Vlan-interface1:
Current machine state: BOUND
Allocated IP: 192.168.0.2 255.255.255.0
Allocated lease: 86400 seconds, T1: 43200 seconds, T2: 75600 seconds
Lease from 2002.09.20 01:05:03 to 2002.09.21 01:05:03
Server IP: 192.168.0.1
Transaction ID = 0x3d8a7431
Default router: 192.168.0.1
Next timeout will happen after 0 days 11 hours 56 minutes 1 seconds.
表2-1 display dhcp client 命令显示信息描述表
字段 |
描述 |
Vlan-interface1 |
客户端动态获取IP地址的接口 |
Current machine state |
客户状态机状态 |
Allocated IP |
客户分配到的IP地址 |
lease |
租约时长 |
T1 |
Renewal定时器时长 |
T2 |
Rebinding定时器时长 |
Lease from….to…. |
租约起止时间 |
Server IP |
选择的DHCP服务器地址 |
Transaction ID |
事务标识 |
Default router |
网关地址 |
Next timeout will happen after 0 days 11 hours 56 minutes 1 seconds. |
下一次定时器超时将出现在11小时56分1秒后 |
【命令】
ip address dhcp-alloc
undo
ip address dhcp-alloc
【视图】
VLAN接口视图
【参数】
无
【描述】
ip address dhcp-alloc命令用来配置VLAN接口通过DHCP方式获取IP地址。undo ip address dhcp-alloc命令用来取消VLAN接口通过DHCP方式获取IP地址。
缺省情况下,VLAN接口不通过DHCP方式获取IP地址。
【举例】
# 配置Vlan-interface1通过DHCP方式获取IP地址。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface Vlan-interface 1
[H3C-Vlan-interface1] ip address dhcp-alloc
【命令】
display
bootp client [ interface Vlan-interface vlan-id ]
【视图】
任意视图
【参数】
vlan-id:VLAN接口编号。
【描述】
display
bootp client命令用来显示BOOTP客户端的相关信息,包括BOOTP客户端的MAC地址和申请到的IP地址等信息。
【举例】
# 显示Vlan-interface1上BOOTP客户端的相关信息。
<H3C> display bootp client interface Vlan-interface 1
Vlan-interface1:
Allocated IP: 192.168.0.2 255.255.255.0
Transaction ID = 0x3d8a7431
Mac Address 000f-e20a-c3ef
表2-2 display bootp client命令显示信息描述表
字段 |
描述 |
Vlan-interface1 |
Vlan-interface1配置为通过BOOTP方式获取IP地址 |
Allocated IP |
所分配到的IP地址 |
Transaction ID |
BOOTP报文中XID字段值 |
Mac Address |
BOOTP客户端的MAC地址 |
【命令】
ip address bootp-alloc
undo
ip address bootp-alloc
【视图】
VLAN接口视图
【参数】
无
【描述】
ip address bootp-alloc命令用来配置VLAN接口通过BOOTP协议获取IP地址。undo ip address bootp-alloc命令用来取消VLAN接口通过BOOTP协议获取IP地址。
缺省情况下,VLAN接口不通过BOOTP协议获取IP地址。
相关配置可参考命令display bootp client。
【举例】
# 配置Vlan-interface1通过BOOTP协议获取IP地址。
<H3C> system-view
System View: return to User View with Ctrl+Z.
[H3C] interface Vlan-interface 1
[H3C-Vlan-interface1] ip address bootp-alloc
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!