DHCP监听实验:
拓扑图如下:
三层交换机配置命令:
system-view
dhcp enable
vlan batch 10 100
interface vlan 10
ip address 192.168.6.1 24
dhcp select relay
dhcp relay server-ip 6.6.6.2
interface vlan 100
ip address 6.6.6.1 30
interface g0/0/24
port link-type access
port default vlan 100
interface g0/0/1
port link-type access
port default vlan 10
interface g0/0/2
port link-type access
port default vlan 10
ip route-stat 0.0.0.0 0.0.0.0 6.6.6.2
二层交换机配置命令(这里只列出一个支路的命令):
system-view
dhcp enable
dhcp snooping enable
interface g0/0/2
dhcp snooping enable
interface g0/0/24
dhcp snooping enable
路由器配置命令:
system-view
interface g0/0/2
ip address 6.6.6.2 30
dhcp enable
ip pool vlan_10
network 192.168.6.0 mask 24
gateway-list 192.168.6.1
dns-list 114.114.114.114 8.8.8.8
lease day 1 hour 1 minute 1
interface g0/0/2
dhcp select global
ip route-static 192.168.6.0 255.255.255.0 6.6.6.1
其中PC机的IP全部设为动态获取:
菜菜的代码,希望能够帮助到你哟!