Huawei-R&S-网络工程师实验笔记20190608-VLAN划分基础(基于端口、MAC地址、子网地址、协议)
》Huawei-R&S-网络工程师实验笔记20190608-VLAN划分基础(基于端口、MAC地址、子网地址、协议)
》》实验开始,先上拓扑图参考:
一、基于端口划分VLAN:
[SWA]vlan 10 //创建VLAN10,这一步是前提(设备默认只有VLAN 1) [SWA-vlan10] Jun 9 2019 02:11:50-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-vlan10]q [SWA]int g0/0/1 [SWA-GigabitEthernet0/0/1]port link-type ? //查询配置端口类型的命令 access Access port dot1q-tunnel QinQ port hybrid Hybrid port trunk Trunk port [SWA-GigabitEthernet0/0/1]port link-type access //配置端口为Access类型 [SWA-GigabitEthernet0/0/1] Jun 9 2019 02:10:10-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-GigabitEthernet0/0/1]port default vlan 10 //将端口划分到VLAN 10 [SWA-GigabitEthernet0/0/1] Jun 9 2019 02:12:40-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/1]int g0/0/2 [SWA-GigabitEthernet0/0/2]port link-type access [SWA-GigabitEthernet0/0/2] Jun 9 2019 02:13:30-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/2]port default vlan 10 [SWA-GigabitEthernet0/0/2] Jun 9 2019 02:14:00-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/2]int g0/0/3 [SWA-GigabitEthernet0/0/3]port link-type access [SWA-GigabitEthernet0/0/3] Jun 9 2019 02:14:50-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/3]port def [SWA-GigabitEthernet0/0/3]port default vlan 10 [SWA-GigabitEthernet0/0/3] Jun 9 2019 02:15:50-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/3]q [SWA]dis vlan //查看VLAN端口信息 The total number of vlans is : 2 -------------------------------------------------------------------------------- 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/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) //默认VLAN 1的端口 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/1(U) GE0/0/2(U) GE0/0/3(U) //3个端口被划分进了VLAN 10 VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 10 enable default enable disable VLAN 0010 [SWA]dis port vlan active //查看VLAN端口信息,显示PVID和VLAN LIST T=TAG U=UNTAG ------------------------------------------------------------------------------- Port Link Type PVID VLAN List ------------------------------------------------------------------------------- GE0/0/1 access 10 U: 10 GE0/0/2 access 10 U: 10 GE0/0/3 access 10 U: 10 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 [SWA]
二、基于MAC地址划分VLAN:
[SWA]dis vlan //检查VLAN状态信息 The total number of vlans is : 1 //显示只有一个默认VLAN 1 -------------------------------------------------------------------------------- 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/2(U) GE0/0/3(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) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 [SWA]vlan 10 //创建VLAN 10 [SWA-vlan10]int g0/0/1 [SWA-GigabitEthernet0/0/1]port hybrid untagged vlan 10 //在G0/0/1(默认Hybrid)端口下配置Untagged VLAN 10 [SWA-GigabitEthernet0/0/1] Jun 9 2019 10:06:42-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/1]int g0/0/2 [SWA-GigabitEthernet0/0/2]port hybrid untagged vlan 10 //在G0/0/2(默认Hybrid)端口下配置Untagged VLAN 10 [SWA-GigabitEthernet0/0/2] Jun 9 2019 10:08:12-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 hybrid untagged vlan 10 //在G0/0/3(默认Hybrid)端口下配置Untagged VLAN 10 [SWA-GigabitEthernet0/0/3] Jun 9 2019 10:08:52-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]q [SWA]dis port vlan active //检查VLAN端口激活状况(Hybrid端口的Untagged列表中默认只有VLAN 1) T=TAG U=UNTAG ------------------------------------------------------------------------------- Port Link Type PVID VLAN List ------------------------------------------------------------------------------- GE0/0/1 hybrid 1 U: 1 10 //Hybrid端口的Untagged列表中配置增加了VLAN 10 GE0/0/2 hybrid 1 U: 1 10 //Hybrid端口的Untagged列表中配置增加了VLAN 10 GE0/0/3 hybrid 1 U: 1 10 //Hybrid端口的Untagged列表中配置增加了VLAN 10 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 [SWA] [SWA]vlan 10 [SWA-vlan10]mac-vlan ? mac-address MAC address [SWA-vlan10]mac-vlan mac-address ? H-H-H MAC address //指定与vlan10关联的MAC地址,常见格式xx:xx:xx:xx:xx:xx,此处xxxx-xxxx-xxxx(都是16进制) [SWA-vlan10]mac-vlan mac-address 5400-0000-0001 ? H-H-H Value of MAC address mask //指定MAC地址的掩码,格式还是xxxx-xxxx-xxxx(16进制) INTEGER<1-48> Length of MAC address mask //指定MAC地址的掩码长度,整数型 priority Priority information //指定MAC地址对应vlan的802.1p优先级[0-7](默认为0,值越大、级越高) <cr> [SWA-vlan10]mac-vlan mac-address 5400-0000-0001 //在vlan10中绑定主机A的MAC地址 Jun 9 2019 10:17:22-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-vlan10]mac-vlan mac-address 5400-0000-0002 //在vlan10中绑定主机B的MAC地址 Jun 9 2019 10:17:32-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-vlan10]mac-vlan mac-address 5400-0000-0003 //在vlan10中绑定主机C的MAC地址 Jun 9 2019 10:18:02-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-vlan10]int g0/0/1 [SWA-GigabitEthernet0/0/1]mac-vlan enable //开启G0/0/1端口下MAC-VLAN Info: This operation may take a few seconds. Please wait for a moment...done. [SWA-GigabitEthernet0/0/1] Jun 9 2019 10:19:02-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 8, the c hange loop count is 0, and the maximum number of records is 4095. [SWA-GigabitEthernet0/0/1]int g0/0/2 [SWA-GigabitEthernet0/0/2]mac-vlan enable //开启G0/0/2端口下MAC-VLAN Info: This operation may take a few seconds. Please wait for a moment...done. [SWA-GigabitEthernet0/0/2] Jun 9 2019 10:19:32-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 9, 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]mac-vlan enable //开启G0/0/3端口下MAC-VLAN Info: This operation may take a few seconds. Please wait for a moment...done. [SWA-GigabitEthernet0/0/3] Jun 9 2019 10:20:02-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 10, the change loop count is 0, and the maximum number of records is 4095. [SWA-GigabitEthernet0/0/3]q [SWA] [SWA]dis mac-vlan mac-address all //检查vlan10中MAC地址绑定条目 --------------------------------------------------- MAC Address MASK VLAN Priority --------------------------------------------------- 5400-0000-0001 ffff-ffff-ffff 10 0 5400-0000-0002 ffff-ffff-ffff 10 0 5400-0000-0003 ffff-ffff-ffff 10 0 Total MAC VLAN address count: 3 [SWA]
三、基于子网地址划分VLAN:
[SWA]display vlan //流程同上,先检查vlan和创建vlan10 --------- [SWA]vlan 10 --------- [SWA-vlan10]int g0/0/1 //再分别进入G0/0/1、2、3端口配置剥离vlan标签的功能 [SWA-GigabitEthernet0/0/1]port hybrid untagged vlan 10 --------- [SWA-GigabitEthernet0/0/1]int g0/0/2 [SWA-GigabitEthernet0/0/2]port hybrid untagged vlan 10 --------- [SWA-GigabitEthernet0/0/2]int g0/0/3 [SWA-GigabitEthernet0/0/3]port hybrid untagged vlan 10 --------- [SWA-GigabitEthernet0/0/3]vlan 10 [SWA-vlan10] [SWA-vlan10]ip-subnet-vlan ? //根据子网信息绑定vlan INTEGER<1-12> Ip-subnet index,ranging from integer 1 to 12 ip IP address [SWA-vlan10]ip-subnet-vlan ip ? X.X.X.X IP address [SWA-vlan10]ip-subnet-vlan ip 192.168.0.1 ? INTEGER<0-32> Length of IP address mask X.X.X.X IP address mask [SWA-vlan10]ip-subnet-vlan ip 192.168.0.1 32 //在vlan10中绑定主机A的IP地址 Jun 9 2019 12:09: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 5, the c hange loop count is 0, and the maximum number of records is 4095. [SWA-vlan10]ip-subnet-vlan ip 192.168.0.2 32 //在vlan10中绑定主机B的IP地址 Jun 9 2019 12:09:24-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-vlan10]ip-subnet-vlan ip 192.168.0.3 32 //在vlan10中绑定主机C的IP地址 Jun 9 2019 12:09: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 7, the c hange loop count is 0, and the maximum number of records is 4095. [SWA-vlan10]dis this # vlan 10 ip-subnet-vlan 1 ip 192.168.0.1 255.255.255.255 ip-subnet-vlan 2 ip 192.168.0.2 255.255.255.255 ip-subnet-vlan 3 ip 192.168.0.3 255.255.255.255 # return [SWA-vlan10]int g0/0/1 [SWA-GigabitEthernet0/0/1]ip-subnet-vlan enable //开启G0/0/1端口下ip-subnet-vlan [SWA-GigabitEthernet0/0/1] Jun 9 2019 12:10: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 8, the c hange loop count is 0, and the maximum number of records is 4095. [SWA-GigabitEthernet0/0/1]int g0/0/2 [SWA-GigabitEthernet0/0/2]ip-subnet-vlan enable //开启G0/0/2端口下ip-subnet-vlan [SWA-GigabitEthernet0/0/2] Jun 9 2019 12:10: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 9, 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]ip-subnet-vlan enable //开启G0/0/3端口下ip-subnet-vlan [SWA-GigabitEthernet0/0/3] Jun 9 2019 12:11: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 10, the change loop count is 0, and the maximum number of records is 4095. [SWA-GigabitEthernet0/0/3]quit [SWA]dis ip-subnet-vlan vlan all //检查vlan10中IP地址(子网)绑定条目 ---------------------------------------------------------------- Vlan Index IpAddress SubnetMask Priority ---------------------------------------------------------------- 10 1 192.168.0.1 255.255.255.255 0 10 2 192.168.0.2 255.255.255.255 0 10 3 192.168.0.3 255.255.255.255 0 ---------------------------------------------------------------- ip-subnet-vlan count: 3 total count: 3 [SWA]
四、基于协议划分VLAN:
[SWA]display vlan //流程同上,先检查vlan和创建vlan10
---------
[SWA]vlan 10
---------
[SWA-vlan10]int g0/0/1 //再分别进入G0/0/1、2、3端口配置剥离vlan标签的功能
[SWA-GigabitEthernet0/0/1]port hybrid untagged vlan 10
---------
[SWA-GigabitEthernet0/0/1]int g0/0/2
[SWA-GigabitEthernet0/0/2]port hybrid untagged vlan 10
---------
[SWA-GigabitEthernet0/0/2]int g0/0/3
[SWA-GigabitEthernet0/0/3]port hybrid untagged vlan 10
---------
[SWA-GigabitEthernet0/0/3]vlan 10
[SWA-vlan10]protocol-vlan ? //根据指定协议划分vlan(华为支持多种二层、三层协议) INTEGER<0-15> Protocol index at AT(AppleTalk Protocol) configuration information ipv4 IPv4 configuration information ipv6 IPv6 configuration information ipx IPX(Internetwork Packet eXchange) configuration information mode Other protocol mode configuration information [SWA-vlan10]protocol-vlan ipv4 //配置根据IPv4协议划分vlan [SWA-vlan10] Jun 9 2019 14:13:29-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-vlan10]int g0/0/1 [SWA-GigabitEthernet0/0/1]protocol-vlan vlan 10 all //开启G0/0/1端口下protocol-vlan,关联vlan10,并引用所有配置协议 Jun 9 2019 14:16:19-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]protocol-vlan vlan 10 ? INTEGER<0-15> Protocol index all All the protocols of the VLAN [SWA-GigabitEthernet0/0/1]int g0/0/2 [SWA-GigabitEthernet0/0/2]protocol-vlan vlan 10 all //开启G0/0/2端口下protocol-vlan,关联vlan10,并引用所有配置协议 [SWA-GigabitEthernet0/0/2] Jun 9 2019 14:17:29-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/2]int g0/0/3 [SWA-GigabitEthernet0/0/3]protocol-vlan vlan 10 all //开启G0/0/3端口下protocol-vlan,关联vlan10,并引用所有配置协议 [SWA-GigabitEthernet0/0/3] Jun 9 2019 14:18:09-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 8, the c hange loop count is 0, and the maximum number of records is 4095. [SWA-GigabitEthernet0/0/3]q [SWA] [SWA]dis protocol-vlan vlan all //查看vlan中绑定的协议 ---------------------------------------------------------------- VLAN Protocol Index Protocol Type ---------------------------------------------------------------- 10 0 ipv4
之所以开博客,纯为记录自己学习的过程,以便查缺补漏。如有参考我的博客,不清晰的地方可以留言或者加好友交流,以助共同进步。