不同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之间的通信。