》Huawei-R&S-网络工程师实验笔记20190609-VLAN划分综合(Access和Trunk端口)
》》实验开始,先上拓扑图参考:

》》》实验目标:将交换机连接主机的端口类型配置为Access端口,并划分到对应的VLAN中;将交换机互联端口配置为Trunk端口,并允许通过vlan10和vlan20.
1[SWA]vlan batch 10 20 //批处理创建vlan10和vlan20 2Info: This operation may take a few seconds. Please wait for a moment...done. 3[SWA] 4Jun 9 2019 16:36:14-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 5.191.3.1 configurations have been changed. The current change number is 1, the c 6hange loop count is 0, and the maximum number of records is 4095. 7 8[SWA]int g0/0/2 9[SWA-GigabitEthernet0/0/2]port link-type access //配置端口G0/0/2的类型为Access端口 10[SWA-GigabitEthernet0/0/2] 11Jun 9 2019 16:47:04-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 12.191.3.1 configurations have been changed. The current change number is 2, the c 13hange loop count is 0, and the maximum number of records is 4095. 14[SWA-GigabitEthernet0/0/2]port default vlan 10 //将端口G0/0/2加入vlan10 15[SWA-GigabitEthernet0/0/2] 16Jun 9 2019 16:48:14-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 17.191.3.1 configurations have been changed. The current change number is 3, the c 18hange loop count is 0, and the maximum number of records is 4095. 19 20[SWA-GigabitEthernet0/0/2]int g0/0/3 21[SWA-GigabitEthernet0/0/3]port link-type access //配置端口G0/0/3的类型为Access端口 22[SWA-GigabitEthernet0/0/3] 23Jun 9 2019 16:48:54-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 24.191.3.1 configurations have been changed. The current change number is 4, the c 25hange loop count is 0, and the maximum number of records is 4095. 26[SWA-GigabitEthernet0/0/3]port default vlan 20 //将端口G0/0/3加入vlan20 27[SWA-GigabitEthernet0/0/3] 28Jun 9 2019 16:49:34-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 29.191.3.1 configurations have been changed. The current change number is 5, the c 30hange loop count is 0, and the maximum number of records is 4095. 31[SWA-GigabitEthernet0/0/3]q 32 33[SWA]int g0/0/1 34[SWA-GigabitEthernet0/0/1]port link-type trunk //配置端口G0/0/1的类型为Trunk端口 35[SWA-GigabitEthernet0/0/1] 36Jun 9 2019 16:50:14-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 37.191.3.1 configurations have been changed. The current change number is 6, the c 38hange loop count is 0, and the maximum number of records is 4095. 39[SWA-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 //配置G0/0/1(Trunk端口)允许vlan10和vlan20通过 40[SWA-GigabitEthernet0/0/1] 41Jun 9 2019 16:51:04-08:00 SWA DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 42.191.3.1 configurations have been changed. The current change number is 7, the c 43hange loop count is 0, and the maximum number of records is 4095. 44[SWA-GigabitEthernet0/0/1]q 45 46[SWA]dis vlan //查看vlan的配置情况 47The total number of vlans is : 3 48-------------------------------------------------------------------------------- 49U: Up; D: Down; TG: Tagged; UT: Untagged; 50MP: Vlan-mapping; ST: Vlan-stacking; 51#: ProtocolTransparent-vlan; *: Management-vlan; 52-------------------------------------------------------------------------------- 53VID Type Ports 54-------------------------------------------------------------------------------- 551 common UT:GE0/0/1(U) GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) 56 GE0/0/7(D) GE0/0/8(D) GE0/0/9(D) GE0/0/10(D) 57 GE0/0/11(D) GE0/0/12(D) GE0/0/13(D) GE0/0/14(D) 58 GE0/0/15(D) GE0/0/16(D) GE0/0/17(D) GE0/0/18(D) 59 GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D) 60 GE0/0/23(D) GE0/0/24(D) 61 6210 common UT:GE0/0/2(U) 63 64 TG:GE0/0/1(U) 65 6620 common UT:GE0/0/3(U) 67 68 TG:GE0/0/1(U) 69 70VID Status Property MAC-LRN Statistics Description 71-------------------------------------------------------------------------------- 721 enable default enable disable VLAN 0001 7310 enable default enable disable VLAN 0010 7420 enable default enable disable VLAN 0020 75 76[SWA]dis port vlan active //查看vlan端口激活情况 77T=TAG U=UNTAG 78------------------------------------------------------------------------------- 79Port Link Type PVID VLAN List 80------------------------------------------------------------------------------- 81GE0/0/1 trunk 1 U: 1 //Trunk端口 Untagged vlan1 82 T: 10 20 //Trunk端口 Tagged vlan10 vlan20 83GE0/0/2 access 10 U: 10 //Access端口 Untagged vlan10 84GE0/0/3 access 20 U: 20 //Access端口 Untagged vlan20 85GE0/0/4 hybrid 1 U: 1 86GE0/0/5 hybrid 1 U: 1 87GE0/0/6 hybrid 1 U: 1 88GE0/0/7 hybrid 1 U: 1 89 ---- More ---- 90 91[SWB]vlan batch 10 20 //在SWB上以此进行类似SWA的配置 92 93[SWB]int g0/0/2 94[SWB-GigabitEthernet0/0/2]port link-type access 95[SWB-GigabitEthernet0/0/2]port default vlan 20 96 97[SWB-GigabitEthernet0/0/2]int g0/0/3 98[SWB-GigabitEthernet0/0/3]port link-type access 99[SWB-GigabitEthernet0/0/3]port default vlan 10 100 101[SWB-GigabitEthernet0/0/3]int g0/0/1 102[SWB-GigabitEthernet0/0/1]port link-type trunk 103[SWB-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 104[SWB-GigabitEthernet0/0/1]q 105 106[SWB]dis vlan 107 108[SWB]dis port vlan active
》》》》配置完成后,ping测试同一vlan内主机互通情况,主机A ping 主机D、主机B ping 主机C 的测试结果如下图:

