》Huawei-R&S-网络工程师实验笔记20190609-VLAN划分综合(Access和Trunk端口)
》》实验开始,先上拓扑图参考:
》》》实验目标:将交换机连接主机的端口类型配置为Access端口,并划分到对应的VLAN中;将交换机互联端口配置为Trunk端口,并允许通过vlan10和vlan20.
[SWA]vlan batch 10 20 //批处理创建vlan10和vlan20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SWA]
Jun 9 2019 16:36:14-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 1, the c
hange loop count is 0, and the maximum number of records is 4095.
[SWA]int g0/0/2
[SWA-GigabitEthernet0/0/2]port link-type access //配置端口G0/0/2的类型为Access端口
[SWA-GigabitEthernet0/0/2]
Jun 9 2019 16:47:04-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 2, the c
hange loop count is 0, and the maximum number of records is 4095.
[SWA-GigabitEthernet0/0/2]port default vlan 10 //将端口G0/0/2加入vlan10
[SWA-GigabitEthernet0/0/2]
Jun 9 2019 16:48:14-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 3, the c
hange loop count is 0, and the maximum number of records is 4095.
[SWA-GigabitEthernet0/0/2]int g0/0/3
[SWA-GigabitEthernet0/0/3]port link-type access //配置端口G0/0/3的类型为Access端口
[SWA-GigabitEthernet0/0/3]
Jun 9 2019 16:48:54-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 4, the c
hange loop count is 0, and the maximum number of records is 4095.
[SWA-GigabitEthernet0/0/3]port default vlan 20 //将端口G0/0/3加入vlan20
[SWA-GigabitEthernet0/0/3]
Jun 9 2019 16:49:34-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 5, the c
hange loop count is 0, and the maximum number of records is 4095.
[SWA-GigabitEthernet0/0/3]q
[SWA]int g0/0/1
[SWA-GigabitEthernet0/0/1]port link-type trunk //配置端口G0/0/1的类型为Trunk端口
[SWA-GigabitEthernet0/0/1]
Jun 9 2019 16:50:14-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 6, the c
hange loop count is 0, and the maximum number of records is 4095.
[SWA-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 //配置G0/0/1(Trunk端口)允许vlan10和vlan20通过
[SWA-GigabitEthernet0/0/1]
Jun 9 2019 16:51:04-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25
.191.3.1 configurations have been changed. The current change number is 7, the c
hange loop count is 0, and the maximum number of records is 4095.
[SWA-GigabitEthernet0/0/1]q
[SWA]dis vlan //查看vlan的配置情况
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:GE0/0/1(U) GE0/0/4(D) GE0/0/5(D) GE0/0/6(D)
GE0/0/7(D) GE0/0/8(D) GE0/0/9(D) GE0/0/10(D)
GE0/0/11(D) GE0/0/12(D) GE0/0/13(D) GE0/0/14(D)
GE0/0/15(D) GE0/0/16(D) GE0/0/17(D) GE0/0/18(D)
GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D)
GE0/0/23(D) GE0/0/24(D)
10 common UT:GE0/0/2(U)
TG:GE0/0/1(U)
20 common UT:GE0/0/3(U)
TG:GE0/0/1(U)
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
[SWA]dis port vlan active //查看vlan端口激活情况
T=TAG U=UNTAG
-------------------------------------------------------------------------------
Port Link Type PVID VLAN List
-------------------------------------------------------------------------------
GE0/0/1 trunk 1 U: 1 //Trunk端口 Untagged vlan1
T: 10 20 //Trunk端口 Tagged vlan10 vlan20
GE0/0/2 access 10 U: 10 //Access端口 Untagged vlan10
GE0/0/3 access 20 U: 20 //Access端口 Untagged vlan20
GE0/0/4 hybrid 1 U: 1
GE0/0/5 hybrid 1 U: 1
GE0/0/6 hybrid 1 U: 1
GE0/0/7 hybrid 1 U: 1
---- More ----
[SWB]vlan batch 10 20 //在SWB上以此进行类似SWA的配置
[SWB]int g0/0/2
[SWB-GigabitEthernet0/0/2]port link-type access
[SWB-GigabitEthernet0/0/2]port default vlan 20
[SWB-GigabitEthernet0/0/2]int g0/0/3
[SWB-GigabitEthernet0/0/3]port link-type access
[SWB-GigabitEthernet0/0/3]port default vlan 10
[SWB-GigabitEthernet0/0/3]int g0/0/1
[SWB-GigabitEthernet0/0/1]port link-type trunk
[SWB-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[SWB-GigabitEthernet0/0/1]q
[SWB]dis vlan
[SWB]dis port vlan active
》》》》配置完成后,ping测试同一vlan内主机互通情况,主机A ping 主机D、主机B ping 主机C 的测试结果如下图: