VLAN 习题
题目要求:某公司交换网络如图所示,其中PC1和PC2同属一个部门,PC3、PC4、PC5同属一个部门,PC6单独属于一个部门,为了阻断不同部门之间的二层通信,划分了3个VLAN,分别为VLAN 10、VLAN 20、VLAN 30。
配置思路:
1、在交换机上创建VLAN。
2、配置交换机上连接PC的端口为Access模式,并加入相应的VLAN。
3、配置交换机之间互连的端口为Trunk模式,并加入相应的VLAN。
配置步骤:
1.在交换机s1 ,s2, s3 ,配置VLAN 10
登录s2 配置操作
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys s2
[s2]vlan 10
[s2-vlan10]quit
[s2]
登录s3 配置操作
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys s3
[s3]vlan 10
[s3-vlan10]quit
[s3]
登录s1配置操作
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys s1
[s1]vlan 10
[s1-vlan10]quit
[s1]
2.关联端口和VLAN10
登录s2 配置操作
[s2]interface GigabitEthernet 0/0/1
[s2-GigabitEthernet0/0/1]port link-type access
[s2-GigabitEthernet0/0/1]port default vlan 10
[s2-GigabitEthernet0/0/1]quit
[s2]interface GigabitEthernet 0/0/2
[s2-GigabitEthernet0/0/2]port link-type trunk
[s2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10
[s2-GigabitEthernet0/0/2]quit
[s2]
登录s3 配置操作
[s3]interface GigabitEthernet 0/0/1
[s3-GigabitEthernet0/0/1]port link-type access
[s3-GigabitEthernet0/0/1]port default vlan 10
[s3-GigabitEthernet0/0/1]quit
[s3]interface GigabitEthernet 0/0/2
[s3-GigabitEthernet0/0/2]port link-type trunk
[s3-GigabitEthernet0/0/2]port trunk allow-pass vlan 10
[s3-GigabitEthernet0/0/2]quit
[s3]
登录s1 配置操作
[s1]interface GigabitEthernet 0/0/1
[s1-GigabitEthernet0/0/1]port link-type trunk
[s1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
[s1-GigabitEthernet0/0/1]quit
[s1]interface GigabitEthernet 0/0/2
[s1-GigabitEthernet0/0/2]port link-type trunk
[s1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10
[s1-GigabitEthernet0/0/2]quit
[s1]
3.交换机上配置 VLAN 20
登录s2 配置操作
系统界面下
[s2]vlan 20
[s2-vlan20]quit
[s3]
登录s3 配置操作
系统界面下
[s3]vlan 20
[s3-vlan20]quit
[s3]
登录s4 配置操作
系统界面下
[Huawei]sys s4
[s4]vlan 20
[s4-vlan20]quit
[s4]
4.关联端口和 VLAN 20
登录s2 配置操作
[s2]interface GigabitEthernet 0/0/3
[s2-GigabitEthernet0/0/3]port link-type access
[s2-GigabitEthernet0/0/3]port default vlan 20
[s2-GigabitEthernet0/0/3]quit
[s2]interface GigabitEthernet 0/0/2
[s2-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
[s2-GigabitEthernet0/0/2]quit
[s2]
登录 s3 配置操作
[s3]interface GigabitEthernet 0/0/3
[s3-GigabitEthernet0/0/3]port link-type access
[s3-GigabitEthernet0/0/3]port default vlan 20
[s3-GigabitEthernet0/0/3]quit
[s3]interface GigabitEthernet 0/0/2
[s3-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
[s3-GigabitEthernet0/0/2]quit
[s3]
登录s4 配置操作
[s4]interface GigabitEthernet 0/0/1
[s4-GigabitEthernet0/0/1]port link-type access
[s4-GigabitEthernet0/0/1]port default vlan 20
[s4-GigabitEthernet0/0/1]quit
[s4]interface GigabitEthernet 0/0/2
[s4-GigabitEthernet0/0/2]port link-type trunk
[s4-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
[s4-GigabitEthernet0/0/2]quit
[s4]
登录s1 配置操作
[s1]interface GigabitEthernet 0/0/3
[s1-GigabitEthernet0/0/3]port link-type trunk
[s1-GigabitEthernet0/0/3]port trunk allow-pass vlan 20
[s1-GigabitEthernet0/0/3]quit
[s1]interface GigabitEthernet 0/0/2
[s1-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
[s1-GigabitEthernet0/0/2]quit
[s1]
5.交换机上配置 VLAN 30
登录s4 配置操作
[s4]vlan 30
[s4-vlan30]quit
[s4]
6.关联端口和VLAN 30
登录s4 配置操作
[s4]interface GigabitEthernet 0/0/3
[s4-GigabitEthernet0/0/3]port link-type access
[s4-GigabitEthernet0/0/3]port default vlan 30
[s4-GigabitEthernet0/0/3]quit
[s4]interface GigabitEthernet 0/0/2
[s4-GigabitEthernet0/0/2]port trunk allow-pass vlan 30
[s4-GigabitEthernet0/0/2]quit
[s4]
登录s1 配置操作
[s1]interface GigabitEthernet 0/0/3
[s1-GigabitEthernet0/0/3]port trunk allow-pass vlan 30
[s1-GigabitEthernet0/0/3]quit
[s1]
7.查看配置(以s1 为例)
[s1]display port vlan
Port Link Type PVID Trunk VLAN List
---------------------------------------------------------------------
GigabitEthernet0/0/1 trunk 1 1 10
GigabitEthernet0/0/2 trunk 1 1 10 20
GigabitEthernet0/0/3 trunk 1 1 20 30
8.保存配置(以s1 为例)
在用户界面视图操作
<s1>save
The current configuration will be written to the device.
Are you sure to continue?[Y/N]y
Now saving the current configuration to the slot 0.
Save the configuration successfully.
<s1>