dis cu 查看当前配置
undo inf enable 消除频繁出现的信息提示\
可以全部一起复制粘贴,不用一条一条
-
拓扑结构
1.三层交换机LSW1配置
创建vlan10,20配上ip;将接口g0/0/1,接口g0/0/2设为trunk模式.
sys
sys lsw1
vlan batch 10 20
int vlan 10
ip add 192.168.10.1 24
int vlan 20
ip add 192.168.20.1 24
配置ge接口
int g 0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
int g 0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
另外开启gvrp模式,并在端口里开启gvrp模式连接另一个交换机
[lsw4]int g0/0/3
[lsw4]gvrp (开启gvrp功能)
[GigabitEthernet0/0/3]port link-type trunk
[GigabitEthernet0/0/3]port trunk all vlan all(允许所有vlan通过)
[GigabitEthernet0/0/3]gvrp (在端口内打开gvrp功能)
2.二层交换机LSW2配置
创建vlan10,20;将接口e0/0/1与e0/0/2设置access模式并分别放入vlan10,20;将将接口g0/0/1设置为trunk模式并允许vlan 10,20标签通过,最后quit退出.
sys
sys lsw2
vlan batch 10 20
配置ge接口
int g 0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
配置ethernet接口
int e 0/0/1
port link-type access
port default vlan 10
int e 0/0/2
port link-type access
port default vlan 20
q
3.二层交换机LSW3配置
创建vlan10,20;将接口g0/0/1设置为trunk模式并允许vlan 10,20标签通过;然后将接口e0/0/3与e0/0/4设置access模式并分别放入vlan10,20;
sys
sys lsw3
vlan batch 10 20
配置ge接口
int g 0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
配置ethernet接口
int e 0/0/3
port link-type access
port default vlan 10
int e 0/0/4
port link-type access
port default vlan 20
q
4.三层交换机LSW4配置
开启gvrp模式连接另一个交换机,在LSW1中已经配置ge3为trunk接口并且开启gvrp
sys
sys lsw4
vlan batch 10 20 30 40
gvrp
int vlan 30
ip add 192.168.30.1 24
int vlan 40
ip add 192.168.40.1 24
int vlan 10
ip add 192.168.10.1 24
int vlan 20
ip add 192.168.20.1 24
int g0/0/1
port link-type trunk
port trunk all vlan all
gvrp
int g 0/0/3
port link-type trunk
port trunk allow-pass vlan 30 40
配置完成后输入 dis vlan查看
显示红框里的内容则为成功
5.二层交换机LSW5配置
sys
sys lsw5
vlan batch 30 40
int g 0/0/1
port link-type trunk
port trunk allow-pass vlan 30 40
int e 0/0/5
port link-type access
port default vlan 30
int e 0/0/6
port link-type access
port default vlan 40
q
PC机配置如下
网关和接口是v20 的对应ip也需要20
PC1 | PC2 | PC3 | PC4 | |
---|---|---|---|---|
IP地址: | 192.168.10.10 | 192.168.20.20 | 192.168.10.30 | 192.168.20.40 |
子网掩码: | 255.255.255.0 | 255.255.255.0 | 255.255.255.0 | 255.255.255.0 |
网关: | 192.168.10.1 | 192.168.20.1 | 192.168.10.1 | 192.168.20.1 |
PC5 | PC6 | |
---|---|---|
IP地址: | 192.168.30.50 | 192.168.40.60 |
子网掩码: | 255.255.255.0 | 255.255.255.0 |
网关: | 192.168.30.1 | 192.168.40.1 |
测试:PC1 PING PC2
PC2 PING PC3
PC3 PING PC4