拓扑图
接口地址池
PC5通过接口地址池获取地址,DHCP服务器和VLAN40的网关为SW4 10.0.40.254
SW4
#
sysname Huawei
#
vlan batch 10 20 30 40
#
dhcp enable
#
interface Vlanif40ip address 10.0.40.254 255.255.255.128dhcp select interface
#
interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 10 20 40
#
SW3
#
sysname SW3
#
undo info-center enable
#
vlan batch 10 20 30 40
#
dhcp enable
#
interface Ethernet0/0/1port link-type trunkport trunk allow-pass vlan 10 20 40#
interface Ethernet0/0/4port link-type accessport default vlan 40
抓包
全局地址池&&DHCP中继
PC4和PC6通过全局地址池获取地址,
SW4
#
interface Vlanif10ip address 10.0.10.254 255.255.255.0dhcp select relaydhcp relay server-ip 10.0.30.2
#
interface Vlanif20ip address 10.0.20.254 255.255.255.0dhcp select relaydhcp relay server-ip 10.0.30.2
#
interface Vlanif30ip address 10.0.30.4 255.255.255.0
#
interface GigabitEthernet0/0/1port link-type accessport default vlan 30
SW3
#
interface Ethernet0/0/2port link-type accessport default vlan 10
#
interface Ethernet0/0/3port link-type accessport default vlan 20
R1
跨网段一定要配置静态路由 ,服务器的回复包才能达到客户端
客户端跨网段通信是由中继实现的
#
interface GigabitEthernet0/0/0ip address 10.0.30.2 255.255.255.0 dhcp select global
#
ip route-static 10.0.10.0 255.255.255.0 10.0.30.4
ip route-static 10.0.20.0 255.255.255.0 10.0.30.4
抓包
验证
基于接口地址池获取的地址 ,客户端地址是网关同网段的IP地址
基于全局地址池获取的地址,
DHCP服务器会选择与接收DHCP请求报文的接口IPv4地址处于同一网段的地址池来进行分配。
问题
SW4的vlanif30的IP地址配置错误导致,和R1无法通信,中继的数据报发不过去,获取不到地址