Vlan间路由
方法一:多层交换机---SVI(常用):switch vitual interface
方法二:单臂路由
注意:不同的VLAN间的通信必须要有三层设备做中转(路由器、多层交换机)
1.创建vlan
[111]vlan batch 10 20
2.划分接口
[111]int gi0/0/1
[111-GigabitEthernet0/0/1]port link-type access
[111-GigabitEthernet0/0/1]port default vlan 10
[111-GigabitEthernet0/0/1]int gi0/0/2
[111-GigabitEthernet0/0/2]port link-type access
[111-GigabitEthernet0/0/2]port default vlan 20
3.给vlan配置地址
[111]int vlan 10
[111-Vlanif10]ip add
[111-Vlanif10]ip address 192.168.10.1 24
[111-Vlanif10]q
[111]int vlan 20
[111-Vlanif20]ip address 192.168.20.1 24
配置主机地址
查看路由表
成功ping通
配置LSW2
1.创建vlan
[111]vlan batch 10 20
2.划分接口
[333]vlan batch 10 20
[333]int gi0/0/2
[333-GigabitEthernet0/0/2]int gi0/0/1
[333-GigabitEthernet0/0/1]port link-type trunk
[333-GigabitEthernet0/0/1]port trunk allow-pass vlan all
为vlan10 20配置ip
[333]vlan 10
[333-Vlanif10]ip address 192.168.10.254 24
[333]int vlan 20
[333-Vlanif20]ip address 192.168.20.254 24
配置LSW3
[111]vlan batch 10 20
[111]int gi0/0/1
[111-GigabitEthernet0/0/1]port link-type trunk
[111-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[111-GigabitEthernet0/0/1]int gi0/0/2
[111-GigabitEthernet0/0/2]port link-type access
[111-GigabitEthernet0/0/2]port default vlan 10
[111-GigabitEthernet0/0/2]int gi0/0/3
[111-GigabitEthernet0/0/3]port link-type access
[111-GigabitEthernet0/0/3]port default vlan 20
[111-GigabitEthernet0/0/3]q
配置LSW4
[222]vlan batch 10 20
[222]int gi0/0/1
[222-GigabitEthernet0/0/1]port link-type trunk
[222-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[222-GigabitEthernet0/0/1]int gi0/0/2
[222-GigabitEthernet0/0/2]port link-type access
[222-GigabitEthernet0/0/2]port default vlan 20
[222-GigabitEthernet0/0/2]int gi0/0/3
[222-GigabitEthernet0/0/3]port link-type access
[222-GigabitEthernet0/0/3]port default vlan 10
[222-GigabitEthernet0/0/3]q
成功ping通