《华为交换机配置手册.docx》由会员分享,可在线阅读,更多相关《华为交换机配置手册.docx(15页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、华为交换机配置手册 华为交换机配置实用手册 2022-10-01 21:35 华为交换机配置实用手册 实验一使用华为Quidway系列交换机简单组网1.1 实验目的 1. 掌握华为Quidway系列交换机上的基本配置命令; 2. 掌握VLAN的原理和配置; 3. 掌握端口聚合(Link Aggregation)的原理和配置; 4. 掌握生成树协议(STP)的原理和配置; 5. 掌握GVRP协议的原理和配置; 6. 掌握三层交换机和访问控制列表(ACL)的原理和配置; 7. 掌握如何从PC机或其他交换机远程配置某交换机。 1.2 实验环境 Quidway S3026以太网交换机 2 台,Quid
2、way S3526以太网交换机1台, PC机4台,标准网线6根 Quidway S3026软件版本:V100R002B01D011;Bootrom版本:V1.1 Quidway S3526软件版本:V100R001B02D006;Bootrom版本:V3.0 1.3 实验组网图 在下面的每个练习中给出。 1.4 实验步骤 1.4.1 VLAN配置 首先依照下面的组网图将各实验设备相连,然后正确的配置各设备的IP地址。有两台Quidway S3026交换机和四台PC机。每台PC机的IP地址指定如下: PCA:10.1.1.1 PCB:10.1.2.1 PCC:10.1.1.2 PCD:10.1.
3、2.2 掩码:255.255.255.0 请完成以下步骤: 1、如上图所示,配置四台PC机属于各自的VLAN。 2、将某些端口配置成trunk端口,并允许前面配置的所有VLAN通过。 3、测试同一VLAN中的PC机能否相互Ping通。 配置如下: SwitchA: SwitchA(config)#vlan 2 /创建VLAN 2 SwitchA (config-vlan2)# switchport ethernet 0/9 /将以太口9划入VLAN 2 SwitchA (config-vlan2)#vlan 3 /创建VLAN 3 SwitchA (config-vlan3)# switchp
4、ort ethernet 0/10 /将以太口10划入VLAN 3 SwitchA (config-vlan3)#interface ethernet 0/1 /进入以太口1的接口配置模式SwitchA (config-if-Ethernet0/1)#switch mode trunk /将e0/1接口设置为trunk模式SwitchA (config-if-Ethernet0/1)#switch trunk allow vlan all /配置允许所有的VLAN通过SwitchB: SwitchB(config)#vlan 2 SwitchB (config-vlan2)# switchpo
5、rt ethernet 0/9 SwitchB (config-vlan2)#vlan 3 SwitchB (config-vlan3)# switchport ethernet 0/10 SwitchB (config-vlan3)#interface ethernet 0/1 SwitchB (config-if-Ethernet0/1)# switch mode trunk SwitchB (config-if-Ethernet0/1)# switch trunk allow vlan all 4、 SwitchA端口e0/1的PVID配置为2,然后从PCA ping PCC,看能否相互
6、Ping通,如果不能Ping通,请说明原因。 华为Quidway系列交换机有一个重要特性:如果帧的VLAN ID等于发送该帧的trunk端口的PVID,那么该帧将会先被删掉tag头,再发送。 5、将SwitchA端口e0/1的配置改为属于VLAN2的接入端口,然后从PCApingPCC。你将会发现虽然SwitchA的e0/1、e0/9,SwitchB的e0/9都属于VLAN2,但PCA却不能Ping通PCC。请说明原因。 有两种方法可以通过改变SwitchB端口e0/1的配置使PCA能Ping通PCC。 方法一:将SwitchB端口e0/1的配置改为属于VLAN2的接入端口; 方法二:将Swi
7、tchB端口e0/1的PVID改为2。 6、通过以上步骤,理解Quidway系列交换机添加和删除802.1qVLANtag头的过程和规则。 1.4.2 端口聚合(Link Aggregation) 在练习一的基础上再将SwitchA端口e0/2和SwitchB端口e0/2互连,如下图所示。VLAN和IP 地址的配置保持不变。 1、将SwitchA和SwitchB的端口e0/1和e0/2配置为端口聚合。 2、改变SwitchA端口e0/1的配置,用“show interface e0/2”观察SwitchB端口e0/2的配置变化。 3、将SwitchA和SwitchB之间的两根双绞线拔掉一根,看
8、看PCA是否仍能Ping通PCC。请说明原因。 4、通过以上步骤,理解端口聚合的功能和配置。 配置如下: SwitchA: SwitchA (config)#link-aggregation e 0/1 to e 0/2 ingress-egress /将e0/1及e0/2做聚合 SwitchA (config)#interface e 0/1 SwitchA (config-if-Ethernet0/1)# switch mode trunk /将e0/1接口设置为trunk模式SwitchA (config-if-Ethernet0/1)# switch trunk allow vlan
9、all /配置允许所有的VLAN通过 SwitchB: SwitchB (config)link-aggregation e 0/1 to e 0/2 ingress-egress SwitchB (config)#interface e 0/1 SwitchB (config-if-Ethernet0/1)# switch mode trunk SwitchB (config-if-Ethernet0/1)# switch trunk allow vlan all - 1.4.3 生成树协议(STP) 我们仍然使用练习二的组网图。这次在SwitchA和SwitchB之间不再用端口聚合,而是配
10、置STP。请完成以下步骤: 1、在两台交换机上使能STP。 2、将SwitchA配置成根桥。 3、用“show spanning-tree statistics Ethernet”命令观察接口状态,并根据显示信息解释spanning-tree protocol的运行机制。 4、用“debug stp packet”命令进一步观察STP生成的BPDU信息。 5、修改SwitchB端口e0/2的优先级为64,然后用“show spanning-tree statistics ethernet0/2”观察端口的变化。 6、修改SwitchB端口e0/2的pathcost为100,然后用“show s
11、panning-tree statistics ethernet0/2”观察端口的变化。 7、将SwitchA和SwitchB之间的两根双绞线拔掉一根,然后在两台交换机上用“show spanning-tree statistics ethernet0/1 to ethernet0/2”观察STP信息的变化。测试PCA是否仍能Ping通PCC。请说明原因,并比较端口聚合和STP的不同。 8、通过以上步骤,理解STP的功能和配置。 配置如下: SwitchA: SwitchA (config)#spanning-tree enable /在全局配置模式下启用STP SwitchB: Switch
12、B (config)#spanning-tree enable /在全局配置模式下启用STP SwitchB (config)#spanning-tree priority 4096 /设置优先级 SwitchB (config)#interface e 0/2 SwitchB (config-if-Ethernet0/2)#spanning-tree pathcost 100 /设置端口的pathcost值 问题: 如果我们将两台交换机的端口e0/1和e0/2配置为trunk端口并且不配置端口聚合和STP,将会发生什么现象?PCA是否仍能Ping通PCC? 1.4.4 通用VLAN注册协议(
13、GVRP) 仍用练习二的组网图。这次在SwitchA和SwitchB上配置GVRP。 请完成以下步骤: 1、配置某些端口为trunk端口,并允许前面配置的所有VLAN通过。 2、在两个trunk端口上使能动态VLAN注册协议GVRP。 3、在SwitchA上注册VLAN6-10,在SwitchB上注册VLAN11-15,观察在每个交换机上的VLAN注册状态。 4、在SwitchA上配置VLAN4并将端口e0/1配置为fixed模式,将SwitchB端口e0/1配置为forbidden模式。观察在每个交换机上的VLAN注册状态。 5、通过以上步骤,理解GVRP的功能和配置。 配置如下: Swit
14、chA SwitchA (config)#gvrp enable /在全局配置模式下启用GVRP SwitchA (config)#switch ethernet 0/1 SwitchA (config-if-Ethernet0/1)# switch mode trunk SwitchA (config-if-Ethernet0/1)# switch trunk allow vlan all SwitchA (config-if-Ethernet 0/1)#gvrp enable /在接口模式下启用GVRP SwitchB SwitchB (config)#gvrp enable Switch
15、B (config)#switch ethernet 0/1 SwitchB (config-if-Ethernet0/1)# switch mode trunk SwitchB (config-if-Ethernet0/1)# switch trunk allow vlan all SwitchB (config-if-Ethernet 0/1)#gvrp enable 1.4.5 三层交换机和ACL 这次我们要用到一台三层交换机QuidwayS3526,具体组网图如下。注意SwitchA是一台三层交换机。 每台PC机的IP地址指定如下: PCA:10.1.1.1 PCB:10.1.2.1
16、PCC:10.1.1.2 PCD:10.1.3.1 掩码:255.255.255.0 请完成以下步骤: 1、如上图所示,配置四台PC机分别属于各自相关的VLAN。 2、配置端口聚合,使SwitchA和SwitchB之间的带宽为200Mbps。 3、配置某些端口为trunk端口并允许前面配置的所有VLAN通过。 4、在两台交换机的端口e0/1配置GVRP,使能动态注册VLAN信息。 5、测试在同一VLAN内的PC机能否互相Ping通。 以上配置我们在前面的练习中已全部学过,另外还需要完成以下工作: 我们需要使PCB不能和PCA、PCC通信,PCD能和PCA、PCB、PCC通信。当然,PCA和PC
17、C仍能互相通信。 我们知道,不同VLAN间的通信在二层是隔离的。所以我们必须寻找一种方法能够通过三层实现通信。SwitchA(QuidwayS3526)是一种三层交换机,能帮助我们解决这个问题。按以下步骤来实现不同VLAN之间的PC机互通: 1、在交换机A上配置VLAN2的接口地址是10.1.1.100,VLAN3的接口地址是10.1.2.100,VLAN4的接口地址是10.1.3.100。 2、将PCA和PCC的网关配置为10.1.1.100,PCB的网关为10.1.2.100,PCD的网关为10.1.3.100。 现在,试着在PC机之间互相Ping,你会发现VLAN不再是隔离的。任何两台计
18、算机现在都能通讯了。但是很明显,我们仍没有实现PCB不能和PCA、PCC通信的目标,那我们应该怎么办呢?S3526上提供了一个方法:使用访问控制列表(ACL)。你可以用ACL来限制10.1.1.0 网段和10.1.2.0网段主机之间的通信。 配置如下: SwitchA (config)link-aggregation e 0/1 to e 0/2 ingress-egress SwitchA(config)#gvrp enable SwitchA(config)#vlan 2 SwitchA (config-vlan2)#port e 0/9 SwitchA (config-vlan2)#vl
19、an 3 SwitchA (config-vlan3)#port e 0/10 SwitchA (config-vlan4)#interface e 0/1 SwitchA (config-if-Ethernet0/1)#trunk all SwitchA (config-if-Ethernet0/1)#gvrp enable SwitchA (config-if-Ethernet0/1)#interface vlan 2 /进入VLAN 2的虚接口配置模式 SwitchA (config-VLAN-Interface2)#ip address 10.1.1.100 255.255.255.0
20、 /配置VLAN 2虚接口的IP地址 SwitchA (config-VLAN-Interface2)#interface vlan 3 SwitchA (config-VLAN-Interface3)#ip address 10.1.2.100 255.255.255.0 SwitchA (config-VLAN-Interface3)#interface vlan 4 SwitchA (config-VLAN-Interface4)#ip address 10.1.3.100 255.255.255.0 SwitchA (config-VLAN-Interface4)#exit Switc
21、hA (config)#rule-map l3 net1tonet2 10.1.1.0 255.255.255.0 10.1.2.0 255.255.255.0 /定义流分类规则 SwitchA (config)#flow-action net1tonet2 deny /定义流的动作 SwitchA (config)#acl net1tonet2 net1tonet2 net1tonet2 /定义访问控制列表 SwitchA (config)#access-group net1tonet2 /将ACL定义的访问控制策略激 现在让我们看一看show running-config的信息: Swit
22、chA(config)#show running-config Building running configuration. Current configuration is : hostname SwitchA rule-map l3 net1tonet2 10.1.1.0 255.255.255.0 10.1.2.0 255.255.255.0 flow-action net1tonet2 deny acl net1tonet2 net1tonet2 net1tonet2 access-group net1tonet2 link-aggregation Ethernet0/1 to Et
23、hernet0/2 ingress-egress gvrp enable interface Aux0/0 vlan 1 vlan 2 port Ethernet0/9 vlan 3 port Ethernet0/10 vlan 4 interface Ethernet0/1 trunk all gvrp enable interface Ethernet0/10 interface NULL0 interface VLAN-Interface2 ip address 10.1.1.100 255.255.255.0 interface VLAN-Interface3 ip address 1
24、0.1.2.100 255.255.255.0 interface VLAN-Interface4 ip address 10.1.3.100 255.255.255.0 line aux 0 no login line vty 0 4 end SwitchB#show running-config Building running configuration. Current configuration is : hostname SwitchB gvrp ! interface Aux0/0 ! vlan 1 ! vlan 2 ! vlan 4 ! interface Ethernet0/
25、1 switchport mode trunk switchport trunk allowed vlan all gvrp ! interface Ethernet0/10 switchport access vlan 4 ! interface Ethernet0/11 . ! interface Ethernet0/2 switchport mode trunk switchport trunk allowed vlan all gvrp ! interface Ethernet0/20 interface Ethernet0/8 ! interface Ethernet0/9 switchport access vlan 2