环境:
vlan10:PC14: 192.168.10.1 255.255.255.0
PC15:192.168.10.2 255.255.255.0
PC18:192.168.10.3 255.255.255.0
vlan 20: PC16: 192.168.20.1 255.255.255.0
PC17: 192.168.20.2 255.255.255.0
1.主机添加好ip地址,子网掩码
2.创建vlan 将pc加入vlan
<Huawei>sys
[Huawei]sysname LW6
[LW6]q
[LW6]vlan 10 创建vlan10
[LW6]interface gi 0/0/2 进入接口
[LW6-GigabitEthernet0/0/2]port link-type access 设置端口模式为access
[LW6-GigabitEthernet0/0/2]port default vlan 10 设置端口默认加入vlan10
[LW6-GigabitEthernet0/0/2]q
[LW6]inter gi 0/0/3
[LW6-GigabitEthernet0/0/3]port link-type access
[LW6-GigabitEthernet0/0/3]port default vlan 10
[LW6-GigabitEthernet0/0/3]q
[LW6]vlan 20
[LW6-vlan20]q
[LW6]interface gi 0/0/4
[LW6-GigabitEthernet0/0/4]port link-type access
[LW6-GigabitEthernet0/0/4]port default vlan 20
LW7同理
3.两台交换机trunk连接
[LW6-GigabitEthernet0/0/4]q
[LW6]interface gi 0/0/1 进入接口
[LW6-GigabitEthernet0/0/1]port link-type trunk 设置端口模式为trunk
(此时查看vlan端口会发现trunk默认只用于vlan1)
[LW6-GigabitEthernet0/0/1]port trunk allow-pass vlan all 设置trunk允许所有vlan
(此时查看vlan,发现trunk已适用于1-4094所有vlan)
LW7同理
检验:
PS:Trunk上允许通过的vlan是叠加的 port trunk allow-pass vlan 10
port trunk allow-pass vlan 20 那么允许通过的就是1 10 20
转载于:https://blog.51cto.com/13721786/2112436