不同VLAN间通信
- 法一:单臂路由
- 法二:SVI接口
实现不同VLAN之间通信
法一:单臂路由
使用路由器的子接口技术,在一个物理接口上虚拟两个子接口作为不同主机的网关,然后进行不同VLAN之间的通信。
配置如下:
SW1:
vlan batch 10 20
int e0/0/1
port link-type access
port default vlan 10
int e0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
int e0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
SW2:
vlan batch 10 20
int e0/0/2
port link-type access
port default vlan 20
int e0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
路由器:
g0/0/0.10
dot1q termination vid 10 // 使用子接口的封装协议,并打上标签
ip address 192.168.10.254 24
arp broadcast enable //开启子接口的ARP广播功能
g0/0/0.20
dot1q termination vid 20
ip address 192.168.20.254 24
arp broadcast enable
结果验证:
法二: SVI接口
使用交换机的虚拟接口来实现不同VLAN间通信,将交换机虚拟接口地址设置为主机的网关地址,从而通过二层达到不同VLAN间通信
如图拓扑:
SW1:
vlan batch 10 20
int e0/0/1
port link-type access
port default vlan 10
int e0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
SW2:
vlan batch 10 20
int e0/0/2
port link-type access
port default vlan 20
int e0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
SW1:
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
#
实验验证: