拓扑图:
单臂路由部分:
1.交换机LSW3
vlan batch 40 50
int g0/0/1
port link-type trunk
port trunk allow-pass vlan 40 50
int g0/0/3
port link-type access
port default vlan 40
int g0/0/4
port link-type access
port default vlan 50
2.路由器AR1
int g0/0/0.1
dot1q termination vid 40
ip address 192.168.3.1 24
arp broadcast enable
int g0/0/0.2
dot1q termination vid 50
ip address 192.168.4.1 24
arp broadcast enable
三层交换:
二层交换机LSW2
创建vlan batch 10 20
int g0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
int g0/0/3
port link-type access
port default vlan 10
int g0/0/4
port link-type access
port default vlan 20
交换机LSW1
vlan batch 1 10 20
int vlanif 10
ip add 192.168.1.254 24
int vlanif 20
ip add 192.168.2.254 24
int vlanif 1
ip add 192.168.10.1 24
int g0/0/1
port link-type access
port default vlan 1
int g0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
ip route-static 192.168.3.0 255.255.255.0 192.168.10.2
ip route-static 192.168.4.0 255.255.255.0 192.168.10.2
路由配置AR1
int g0/0/0
ip address 192.168.10.2 24
ip route-static 192.168.1.0 24 192.168.10.1
ip route-static 192.168.2.0 24 192.168.10.1
测试:
PC1 ping PC2
PC1 ping PC3
PC4 ping PC1
PC2 ping PC3
以上测试为部分截图,最终实现全网通信
注:由于连接时交换机和路由接口有变化,所以拓扑图和实际配置接口有所不同。