基于 STP 的可靠网络配置

1.项目背景

        Jan16 公司为提高网络的可靠性,使用了两台高性能交换机作为核心交换机,接入层交
换机与核心层交换机互联,形成冗余结构,拓扑如图 1 所示,具体要求如下:
(1) 为避免交换环路问题,需配置交换机的 STP 功能,要求核心交换机有较高优先
级,SW1 为根交换机,SW2 为备用根交换机,SW1-SW3 和 SW1-SW4 为主链路;
(2) 技术部使用 VLAN10,网络地址为 10.0.1/24,PC1 和 PC2 分别接入到 SW3 和 SW4。

2.项目规划设计

        根据拓扑图 1 可知,SW1 和 SW2 为核心交换机,其中将 SW1 配置为根交换机,SW2 为备
用根交换机;SW3 和 SW4 作为接入交换机,其中 SW1-SW3 及 SW1-SW4 的链路由主链路,SW2- SW4 及 SW2-SW3 的 2 条链路作为备用链路。
        因此在 STP 配置中可将 SW1 的优先级设为最高,SW2 的优先级为次高,如:SW1 的优先
级为 0,SW2 的优先级为 4096。
        同时,考虑到技术部的计算机划分在 VLAN10 的网段内,且计算机连接在不同的交换机 上,故交换机之间的链路需配置为 Trunk 模式。
        具体配置步骤如下:
        (1) 创建 VLAN
        (2) 将交换机端口划分至相应 VLAN
        (3) 开启 STP
        (4) 配置 STP 优先级
        (5) 配置各部门计算机的 IP 地址
具体规划如下表:
VLAN ID
VLAN 描述信息
IP 地址段
用途
Vlan10
Technical
10.0.1.1-5/24
技术部

本端设备
端口号
端口类型
对端设备
对端接口
SW1
Eth0/0/1
Trunk
SW3
Eth0/0/1
SW1
Eth0/0/2
Trunk
SW4
Eth 0/0/1
SW1
Eth0/0/3
Trunk
SW2
Eth 0/0/3
SW2
Eth0/0/1
Trunk
SW3
Eth0/0/2
SW2
Eth0/0/2
Trunk
SW4
Eth0/0/2
SW2
Eth0/0/3
Trunk
SW1
Eth0/0/3
SW3
Eth0/0/1
Trunk
SW1
Eth0/0/1
SW3
Eth0/0/2
Trunk
SW2
Eth0/0/1
SW3
Eth0/0/10
Access
技术部 PC1
Eth0/0/1
SW4
Eth0/0/1
Trunk
SW1
Eth0/0/2
SW4
Eth0/0/2
Trunk
SW2
Eth0/0/2
SW4
Eth0/0/10
Access
技术部 PC1
Eth0/0/1
PC1
Eth0/0/1
Null
SW3
Eth0/0/10
PC2
Eth0/0/1
Null
SW4
Eth0/0/10
计算机
IP 地址
技术部 PC1
10.0.1.1/24
技术部 PC2
10.0.1.2/24

3.项目实施

(1)创建 VLAN

        为各部门创建相应的 VLAN。
        1. SW1 的配置
[Huawei]system-view
[Huawei]sysname SW1
[SW1]vlan 10
[SW1-vlan10]description Technical
        2.SW2 的配置
[Huawei]system-view
[Huawei]sysname SW2
[SW2]vlan 10
[SW2-vlan10]description Technical

        3.SW3 的配置

[Huawei]system-view
[Huawei]sysname SW3
[SW3]vlan 10
[SW3-vlan10]description Technical

        4.SW4 的配置

[Huawei]system-view
[Huawei]sysname SW4
[SW4]vlan 10
[SW4-vlan10]description Technical

(2)将端口划分至相应 VLAN

        SW1 的配置

[SW1]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/3
[SW1-port-group]port link-type trunk 
[SW1-Ethernet0/0/1]port link-type trunk 
[SW1-Ethernet0/0/2]port link-type trunk 
[SW1-Ethernet0/0/3]port link-type trunk
[SW1-port-group]port trunk allow-pass vlan 10
[SW1-Ethernet0/0/1]port trunk allow-pass vlan 10
[SW1-Ethernet0/0/2]port trunk allow-pass vlan 10
[SW1-Ethernet0/0/3]port trunk allow-pass vlan 10

        SW2 的配置

[SW2]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/3
[SW2-port-group]port link-type trunk 
[SW2-Ethernet0/0/1]port link-type trunk 
[SW2-Ethernet0/0/2]port link-type trunk 
[SW2-Ethernet0/0/3]port link-type trunk
[SW2-port-group]port trunk allow-pass vlan 10
[SW2-Ethernet0/0/1]port trunk allow-pass vlan 10
[SW2-Ethernet0/0/2]port trunk allow-pass vlan 10
[SW2-Ethernet0/0/3]port trunk allow-pass vlan 10
        SW3 的配置
[SW3]interface Ethernet0/0/10
[SW3-Ethernet0/0/10]port link-type access
[SW3-Ethernet0/0/10]port default vlan 10
[SW3]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[SW3-port-group]port link-type trunk 
[SW3-Ethernet0/0/1]port link-type trunk 
[SW3-Ethernet0/0/2]port link-type trunk
[SW3-port-group]port trunk allow-pass vlan 10
[SW3-Ethernet0/0/1]port trunk allow-pass vlan 10
[SW3-Ethernet0/0/2]port trunk allow-pass vlan 10
        SW4 的配置
[SW4]interface Ethernet0/0/10
[SW4-Ethernet0/0/10]port link-type access
[SW4-Ethernet0/0/10]port default vlan 10
[SW4]port-group group-member Ethernet 0/0/1 to Ethernet 0/0/2
[SW4-port-group]port link-type trunk 
[SW4-Ethernet0/0/1]port link-type trunk 
[SW4-Ethernet0/0/2]port link-type trunk
[SW4-port-group]port trunk allow-pass vlan 10
[SW4-Ethernet0/0/1]port trunk allow-pass vlan 10
[SW4-Ethernet0/0/2]port trunk allow-pass vlan 10

(3)开启 STP

         SW1 的配置
[SW1]stp enable 
[SW1]stp mode stp

        SW2 的配置

[SW2]stp enable 
[SW2]stp mode stp

        SW3 的配置

[SW3]stp enable 
[SW3]stp mode stp
        SW4 的配置
[SW4]stp enable 
[SW4]stp mode stp

(4)配置 STP 优先级

将 SW1 配置为主根交换机,SW2 为备份根交换机。
方法 1:SW1 的优先级改为 0,SW2 的优先级改为 4096
        SW1 的配置
[SW1]stp priority 0
        SW2 的配置
[SW2]stp priority 4096
        方法 2:首先删除在 SW1 上所配置的优先级,使用 stp root primary 命令配置主根交
换机。
[SW1]undo stp priority
[SW1]stp root priority
        删除在 SW2 上所配置的优先级,使用 stp root secondary 命令配置备份根交换机
[SW2]undo stp priority
[SW2]stp root secondary

(5)配置各部门计算机的 IP 地址

项目验证

(1)验证各交换机的 VLAN 配置信息

        SW1 的配置

[SW1]dis 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:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(U) Eth0/0/4(D) 
 Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D) 
 Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D) 
 Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) 
 Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D) 
 Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D) 
10 common TG:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(U) 
VID Status Property MAC-LRN Statistics Description 
-------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001 
10 enable default enable disable Technical

        SW2 的配置

[SW2]dis 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:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(U) Eth0/0/4(D) 
 Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D) 
 Eth0/0/9(D) Eth0/0/10(D) Eth0/0/11(D) Eth0/0/12(D) 
 Eth0/0/13(D) Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) 
 Eth0/0/17(D) Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D) 
 Eth0/0/21(D) Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D) 
10 common TG:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(U) 
VID Status Property MAC-LRN Statistics Description 
-------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001 
10 enable default enable disable Technical
        SW3 的配置
[SW3]dis 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:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(D) Eth0/0/4(D) 
 Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D) 
 Eth0/0/9(D) Eth0/0/11(D) Eth0/0/12(D) Eth0/0/13(D) 
 Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) Eth0/0/17(D) 
 Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D) Eth0/0/21(D) 
 Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D) 
10 common UT:Eth0/0/10(U) 
 TG:Eth0/0/1(U) Eth0/0/2(U) 
VID Status Property MAC-LRN Statistics Description 
-------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001 
10 enable default enable disable Technical
        SW4 的配置
[SW4]dis 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:Eth0/0/1(U) Eth0/0/2(U) Eth0/0/3(D) Eth0/0/4(D) 
 Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D) 
 Eth0/0/9(D) Eth0/0/11(D) Eth0/0/12(D) Eth0/0/13(D) 
 Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) Eth0/0/17(D) 
 Eth0/0/18(D) Eth0/0/19(D) Eth0/0/20(D) Eth0/0/21(D) 
 Eth0/0/22(D) GE0/0/1(D) GE0/0/2(D) 
10 common UT:Eth0/0/10(U) 
 TG:Eth0/0/1(U) Eth0/0/2(U) 
VID Status Property MAC-LRN Statistics Description 
-------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001 
10 enable default enable disable Technical

(2)查看各交换机的 STP 状态

        查看各交换机 STP 状态信息,SW1、SW2 使用 display stp 命令查看 stp 模式是否正确,
SW3、SW4 使用 display stp brief 命令查看备用端口是否处于 Discarding 状态。
        SW1 的配置
[SW1]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :0 .4c1f-cc13-37a8
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .4c1f-cc13-37a8 / 0
CIST RegRoot/IRPC :0 .4c1f-cc13-37a8 / 0
……

        SW2 的配置

[SW2]dis stp
-------[CIST Global Info][Mode STP]-------
CIST Bridge :4096 .4c1f-ccf2-272d
Config Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
Active Times :Hello 2s MaxAge 20s FwDly 15s MaxHop 20
CIST Root/ERPC :0 .4c1f-cc13-37a8 / 200000
CIST RegRoot/IRPC :4096 .4c1f-ccf2-272d / 0
……

        SW3 的配置

[SW3]display stp brief
MSTID Port Role STP State Protection
 0 Ethernet0/0/1 ROOT FORWARDING NONE
 0 Ethernet0/0/2 ALTE DISCARDING NONE
 0 Ethernet0/0/10 DESI FORWARDING NONE

        SW4 的配置

[SW4]display stp brief 
MSTID Port Role STP State Protection
 0 Ethernet0/0/1 ROOT FORWARDING NONE
 0 Ethernet0/0/2 ALTE DISCARDING NONE
 0 Ethernet0/0/10 DESI FORWARDING NONE

(3)测试各部门计算机的互通性

通过 Ping 命令,测试各部门内部通信息的情况。
使用财务部计算机 Ping 本部门的计算机:
PC>ping 10.0.1.2
Ping 10.0.1.2: 32 data bytes, Press Ctrl_C to break
From 10.0.1.2: bytes=32 seq=1 ttl=128 time=156 ms
From 10.0.1.2: bytes=32 seq=2 ttl=128 time=125 ms
From 10.0.1.2: bytes=32 seq=3 ttl=128 time=140 ms
From 10.0.1.2: bytes=32 seq=4 ttl=128 time=157 ms
From 10.0.1.2: bytes=32 seq=5 ttl=128 time=156 ms
--- 10.0.1.2 ping statistics ---
 5 packet(s) transmitted
 5 packet(s) received
 0.00% packet loss
 round-trip min/avg/max = 125/146/157 ms
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

晴空哦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值