单臂路由实现不同vlan之间通信
access链路:交换机连接主机的端口
trunk链路:交换机连接路由器的端口
hybrid链路:华为
路由的物理接口可以被划分为多个逻辑接口
每个子接口对应一个vlan网段的网关
(1)配置链路类型
(2)配置vlan标签的封装结构
(3)配置子接口地址
例题1:
实验结果:
代码:
例题2:
实验结果:
实验代码:
SW1:
vlan batch 10 20
port-group 1
group-member g0/0/1 to g0/0/2
port link-type access
port default vlan 10
q
port-group 2
group-member g0/0/3 to g0/0/4
port link-type access
port default vlan 20
q
port-group 3
group-member g0/0/5 to g0/0/6
port link-type trunk
port trunk allow-pass vlan all
SW2:
vlan batch 10 20
int g0/0/1
port link-type trunk
port trunk allow-pass vlan all
int g0/0/2
port link-type access
port default vlan 10
int g0/0/3
port link-type access
port default vlan 20
AR1:
int g0/0/0.10
dotlq termination vid 10
ip add 192.168.10.1 24
arp broadcast enable
int g0/0/0.20
dotlq termination vid 120
ip add 192.168.20.1 24
arp broadcast enable
使用三层交换技术实现vlan间通讯
三层交换=二层交换+三层转发
实验结果:
实验代码:
SW1:
vlan batch 10 20 30
int e0/0/1
port link-type access
port default vlan 10
int e0/0/2
port link-type access
port default vlan 20
int e0/0/3
port link-type access
port default vlan 30
int e0/0/4
port link-type trunk
port trunk allow-pass vlan all
SW2:
vlan batch 10 20 30
int Vlanif 10
ip add 192.168.1.254 24
int Vlanif 20
ip add 192.168.2.254 24
int Vlanif 30
ip add 192.168.3.254 24
int Vlanif 100
ip add 192.168.4.1 24
int g0/0/1
port link-type trunk
port trunk allow-pass vlan all
int g0/0/2
port link-type access
port default vlan 100
q
ip route-static 192.168.5.0 24 192.168.4.2
AR1:
int g0/0/0
ip add 192.168.4.2 24
int g0/0/1
ip add 192.168.5.254
q
ip route-static 192.168.1.0 24 192.168.4.1
ip route-static 192.168.2.0 24 192.168.4.1
ip route-static 192.168.3.0 24 192.168.4.1