拓扑图 S5700作为核心设备,配置DHCP,为办公网络分配IP地址 S2700作为接入设备
S5700配置
vlan 100 description bangong
interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 100
interface Vlanif100 ip address 192.168.10.254 255.255.255.0
S2700配置
vlan 100 description bangong
interface Ethernet0/0/1 port link-type trunk port trunk allow-pass vlan 100
interface Ethernet0/0/2 port link-type access port default vlan 100
interface Ethernet0/0/3 port link-type access port default vlan 100
interface Ethernet0/0/4 port link-type access port default vlan 100
开启DHCP
dhcp enable
配置地址池,并做静态绑定,PC1只能获取到192.168.10.1 PC2只能获取到192.168.10.2 剩余地址保留,不做分配,防止外部人员接入。 ip pool bangong gateway-list 192.168.10.254 network 192.168.10.0 mask 255.255.255.0 static-bind ip-address 192.168.10.1 mac-address 5489-98e7-7f28 static-bind ip-address 192.168.10.2 mac-address 5489-98d8-4d8c excluded-ip-address 192.168.10.3 192.168.10.253 dns-list 8.8.8.8
在虚接口下启用全局dhcp interface Vlanif100 ip address 192.168.10.254 255.255.255.0 dhcp select global
在PC上验证分配的地址 PC1
PC2 我们断开PC2网线,假设PC2没有接入,验证PC3是否能获取DHCP分配给PC2的地址