一、实验环境:
下面拓扑图实现全网互通
二、实验步骤:
1、分析:
配置SW1:
将e0/0/1,e0/0/2,e0/0/3,e0/0/4配置access口的vlan10和20口,将g0/0/1配置trunk口的vlan10 20
vlan batch 10 20
int e0/0/1
port link-type access
port default vlan 10
undo shutdown
int e0/0/2
port link-type access
port default vlan 10
undo shutdown
int e0/0/3
port link-type access
port default vlan 10
undo shutdown
int e0/0/4
port link-type access
port default vlan 20
undo shutdown
int g0/0/1
port link-type trunk
port trunk allow-pass vlan 20
undo shutdown
配置R1:
将g0/0/0,g0/0/2配置图上给的地址,接下来在g0/0/1的子接口中配置dhcp模式,并配置连接的路由表
int g0/0/0
ip add 12.0.0.1 24
int g0/0/2
ip add 14.0.0.2 24
dhcp enable
int g0/0/1.10
dot1q termination vid 10
ip add 192.168.10.1 24
arp broadcast enable
dhcp select relay
dhcp relay server-ip 14.0.0.2
int g0/0/1.20
dot1q termination vid 20
ip add 192.168.20.1 24
arp broadcast enable
dhcp select relay
dhcp relay server-ip 14.0.0.2
ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
配置R2:
将g0/0/0配置地址,g0/0/1配置dhcp模式,并配置连接的路由表
int g0/0/0
ip add 12.0.0.2 24
dhcp enable
int g0/0/1
ip add 15.0.0.1 24
dhcp select relay
dhcp relay serer-ip 14.0.0.2
ip route-static 192.168.10.0 24 12.0.0.1
ip route-static 192.168.20.0 24 12.0.0.1
ip route-static 14.0.0.0 24 12.0.0.1
配置R3:
配置g0/0/0口的dhcp中继,并配置路由表
dhcp enable
ip pool DHCP15
network 15.0.0.0 mask 24
gateway-list 15.0.0.1
dns-list 8.8.8.8 2.2.2.2
excluded-ip-address 15.0.0.100 15.0.0.254
ip pool DHCPVLAN10
network 192.168.10.0 mask 24
gateway-list 192.168.10.1
dns-list 8.8.8.8 2.2.2.2
ip pool DHCPVLAN20
network 192.168.20.0 mask 24
gateway-list 192.168.20.1
dns-list 8.8.8.8 2.2.2.2
int g0/0/0
dhcp select global
2、图示步骤
SW1配置:配置sw1口:配置vlan口和 trunk口
配置R1:g0/0/0和g0/0/2配置地址,g0/0/1配置地址和DHCP模式,配14,10,20的路由
配置R2:g0/0/0配置地址,g0/0/1配置DHCP模式,配置默认路由
配置R3:DHCP模式配置,配置默认路由
查看地址ping