![](https://csdnimg.cn/release/download_crawler_static/88019022/bg4.jpg)
题目 3:第 2 项配置 VLAN。
VLAN42 使用网段 192.168.42.0/24,网关 192.168.42.1; //网关使用.1,为
了方便
VLAN92 使用网段 192.168.92.0/24,网关 192.168.92.1;
VLAN142 使用网段 192.168.142.0/24,网关 192.168.142.1;
VLAN192 使用网段 192.168.192.0/24,网关 192.168.192.1;
命令:
核心交换机配置如下
[LSW1]vlan batch 42 92 142 192 //批量创建 vlan
[LSW1]port-group 1 //创建一个端口组 1
[LSW1-port-group-1]group-member Eth-Trunk 1 g0/0/3 to g0/0/6 //将交
换机的一个逻辑接口 eth-trunk1 和四个物理接口加入端口组
[LSW1-Eth-Trunk1]port link-type trunk //接口类型为 trunk
[LSW1-GigabitEthernet0/0/3]port link-type trunk
[LSW1-port-group-1]port trunk allow-pass vlan all
[LSW1-Eth-Trunk1]port trunk allow-pass vlan all
[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan all //允许所有
的 vlan 通过
[LSW1-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[LSW1-GigabitEthernet0/0/5]port trunk allow-pass vlan all
[LSW1-GigabitEthernet0/0/6]port trunk allow-pass vlan all
交换机 2 上同样的配置,道理相同
[LSW2]vlan batch 42 92 142 192
Info: This operation may take a few seconds. Please wait for a
moment...done.
[LSW2]port-group 1
[LSW2-port-group-1]group-member Eth-Trunk 1 g0/0/3 to g0/0/6
[LSW2-port-group-1]port link-type trunk
[LSW2-Eth-Trunk1]port link-type trunk
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/4]port link-type trunk
[LSW2-GigabitEthernet0/0/5]port link-type trunk
[LSW2-GigabitEthernet0/0/6]port link-type trunk
[LSW2-port-group-1]port trunk allow-pass vlan all
[LSW2-Eth-Trunk1]port trunk allow-pass vlan all
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan all