兩臺交換機不同網絡段的主機通過兩臺交換機進行互訪?Topo 如下
實現192.168.10.10 與192.168.11.10 、192.168.13.10 互通
###在SW3 上配置
### SW3 上配置
vlan batch 10 13 100
#
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
#
interface Vlanif13
ip address 192.168.13.1 255.255.255.0
#
interface Vlanif100
ip address 192.168.100.1 255.255.255.0
#
interface GigabitEthernet0/0/2
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 100
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 13
###SW5 配置
vlan batch 11 12 100
#
interface Vlanif11
ip address 192.168.11.1 255.255.255.0
#
interface Vlanif12
ip address 192.168.12.1 255.255.255.0
#
interface Vlanif100
ip address 192.168.100.2 255.255.255.0
#
interface GigabitEthernet0/0/2
port link-type trunk
undo port trunk allow-pass vlan 1
port trunk allow-pass vlan 100
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 12
#
interface GigabitEthernet0/0/4
port link-type access
port default vlan 11
## 配置靜態路由
添加靜態路由的目的是 找到出口,把訪問所有192.168.11.0 所有的網絡都指向下一跳出口192.168.100.2,同理在對端也寫回來的靜態路由。
##SW3
##SW3 執行
ip route-static 192.168.11.0 255.255.255.0 192.168.100.2
ip route-static 192.168.12.0 255.255.255.0 192.168.100.2
##SW5
## SW5 上執行
ip route-static 192.168.10.0 255.255.255.0 192.168.100.1
ip route-static 192.168.13.0 255.255.255.0 192.168.100.1
## 測試
PC>ping 192.168.10.10 -t
Ping 192.168.10.10: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.10.10: bytes=32 seq=2 ttl=126 time=63 ms
From 192.168.10.10: bytes=32 seq=3 ttl=126 time=78 ms
PC>ping 192.168.11.10 -t
Ping 192.168.11.10: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.11.10: bytes=32 seq=2 ttl=127 time=31 ms
From 192.168.11.10: bytes=32 seq=3 ttl=127 time=32 ms
PC>ping 192.168.12.10 -t
Ping 192.168.12.10: 32 data bytes, Press Ctrl_C to break
From 192.168.12.10: bytes=32 seq=1 ttl=128 time<1 ms
From 192.168.12.10: bytes=32 seq=2 ttl=128 time<1 ms
PC>ping 192.168.13.10 -t
Ping 192.168.13.10: 32 data bytes, Press Ctrl_C to break
From 192.168.13.10: bytes=32 seq=1 ttl=126 time=79 ms
From 192.168.13.10: bytes=32 seq=2 ttl=126 time=63 ms