# 使能DHCP服务。
<SwitchA> system-view
[SwitchA] dhcp enable
# 配置VLAN接口1工作在DHCP中继模式。
[SwitchA] interface vlan-interface 1
[SwitchA-Vlan-interface1] ip address 10.10.1.1 24
[SwitchA-Vlan-interface1] dhcp select relay
[SwitchA-Vlan-interface1] quit
# 配置DHCP服务器的地址,并配置VLAN接口1对应DHCP服务器组1。
[SwitchA] dhcp relay server-group 1 ip 10.1.1.1
[SwitchA] interface vlan-interface 1
[SwitchA-Vlan-interface1] dhcp relay server-select 1
[SwitchA-Vlan-interface1] quit
# 在DHCP中继上为Host A配置一条静态用户地址表项,IP地址为10.10.1.5/24,MAC地址为0001-0010-0001。
[SwitchA] dhcp relay security static 10.10.1.5 0001-0010-0001
# 开启DHCP中继地址匹配检查功能。
[SwitchA] interface Vlan-interface 1
[SwitchA-Vlan-interface1] dhcp relay address-check enable
[SwitchA-Vlan-interface1] quit
这样之后,先用电脑ping一下网关,然后用下面命令查看一下dhcp relay security查看一下dhcp 安全表项:命令如下:
<Sysname> display dhcp relay security
IP Address MAC Address Type Interface
10.1.1.1 00e0-0000-0001 Static Eth1/1
10.1.1.5 00e0-0000-0000 Static Vlan2
--- 2 dhcp-security item(s) found ---
(删除命令 undo dhcp relay security 192.168.0.1)
转载于:https://blog.51cto.com/jstrong/963903