不同vlan之間的路由,實現方式
--多臂路由實現vlan間通信
--單臂路由實現vlan間通信
--三層交換機實現vlan間通信
1 多臂路由實現vlan間通信
如下圖

AR1路由器配置
<Huawei>system-view [Huawei]undo info-center enable [Huawei]sysname R1 [R1]interface GigabitEthernet 0/0/0 [R1-GigabitEthernet0/0/0]ip address 192.168.100.254 24 [R1]interface GigabitEthernet 0/0/1 [R1-GigabitEthernet0/0/1]ip address 192.168.200.254 24 [R1]display ip routing-table protocol direct//當配置完接口的ip地址后,設備上自動得到直接路由(多臂路由,單臂路由也是)通過直接連路由來轉發不同VLAN的數據包 Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Public routing table : Direct Destinations : 10 Routes : 10 Direct routing table status : <Active> Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.100.0/24 Direct 0 0 D 192.168.100.254 GigabitEthernet 0/0/0 192.168.100.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.100.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.200.0/24 Direct 0 0 D 192.168.200.254 GigabitEthernet 0/0/1 192.168.200.254/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 192.168.200.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0 Direct routing table status : <Inactive> Destinations : 0 Routes : 0
交換機的配置
<Huawei>system-view [Huawei]undo info-center enable [Huawei]sysname sw1 [sw1]vlan batch 100 200 [sw1]interface Eth0/0/1 [sw1-Ethernet0/0/1]port link-type access [sw1-Ethernet0/0/1]port default vlan 100 [sw1]interface Eth0/0/4 [sw1-Ethernet0/0/4]port link-type access [sw1-Ethernet0/0/4]port default vlan 200 [sw1]interface Eth0/0/2 [sw1-Ethernet0/0/2]port link-type access [sw1-Ethernet0/0/2]port default vlan 100 [sw1]interface Eth0/0/3 [sw1-Ethernet0/0/3]port link-type access [sw1-Ethernet0/0/3]port default vlan 200 [sw1]display port vlan active //驗證vlan的划分情況 T=TAG U=UNTAG --------------------------------------------------------------------- Port Link Type PVID VLAN List --------------------------------------------------------------------- Eth0/0/1 access 100 U: 100 Eth0/0/2 access 100 U: 100 Eth0/0/3 access 200 U: 200 Eth0/0/4 access 200 U: 200 Eth0/0/5 hybrid 1 U: 1
Pc1配置

Pc1 ping網關和pc2

在實際應用當中,這種是不常見的,常見是單臂路由和三層交換機來實現不同vlan之間的通信。
