拓扑图
设备配置
- PC设置选择DHCP获取IP
- 将PC划分进vlan
- AR1充当DHCP服务器
- 在AR1配置两个地址池
- 添加两条到客户机的静态路由
- 地址池下发
[R1-GigabitEthernet0/0/0]dhcp enable
[R1]ip pool dhcp1
[R1-ip-pool-dhcp1]network 192.168.10.0 mask 255.255.255.0
[R1-ip-pool-dhcp1]gateway-list 192.168.10.1
[R1-ip-pool-dhcp1]dns-list 2.2.2.2 124.124.124.124
[R1-ip-pool-dhcp1]lease day 5
[R1-ip-pool-dhcp1]q
[R1]ip pool dhcp1
[R1-ip-pool-dhcp1]display this
#
ip pool dhcp1
gateway-list 192.168.10.1
network 192.168.10.0 mask 255.255.255.0
lease day 5 hour 0 minute 0
dns-list 2.2.2.2 124.124.124.124
#
[R1]ip pool dhcp2
[R1-ip-pool-dhcp2]network 192.168.20.0 mask 24
[R1-ip-pool-dhcp2]gateway-list 192.168.20.1
[R1-ip-pool-dhcp2]dns-list 4.4.4.4 6.6.6.6
[R1-ip-pool-dhcp2]lease day 6
[R1-ip-pool-dhcp2]q
[R1]ip pool dhcp2
[R1-ip-pool-dhcp2]display this
#
ip pool dhcp2
gateway-list 192.168.20.1
network 192.168.20.0 mask 255.255.255.0
lease day 6 hour 0 minute 0
dns-list 4.4.4.4 6.6.6.6
#
[R1]ip route-static 192.168.10.0 24 10.1.1.10
[R1]ip route-static 192.168.20.0 24 10.1.1.10
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]dhcp select global
[R1-GigabitEthernet0/0/0]quit
- 在SW1上,设置DHCP中继
[L3-SW1]int vlan 10
[L3-SW1-Vlanif10]dhcp select relay
[L3-SW1-Vlanif10]dhcp relay server-ip 10.1.1.1
[L3-SW1-Vlanif10]int vlan 20
[L3-SW1-Vlanif20]dhcp select relay
[L3-SW1-Vlanif20]dhcp relay server-ip 10.1.1.1
[L3-SW1-Vlanif20]quit
在PC上查看结果
- PC1
- PC2
- PC3
- PC4