一、目的

(1) 理解 portfast 的工作场合和配置

(2) 理解 uplinkfast 的工作场合和配置

(3) 理解 backbonefast 的工作场合和配置

二、 拓扑

创建赫夫曼树代码流程图(生成树中的portfastuplinkfastbackbonefast是怎么玩的)(1)

三、步骤

上章我们完成了STP配置,我们将只关心 VLAN 1 的 STP 树。

(1) 步骤 1:配置 portfast

图 14-1 中,S1 的 f0/5 是用于接入计算机。当计算机接入时,f0/5 接口立即进入

Listening 状态,随后经过 Learning,最后才成为 Forwarding,这期间需要 30 秒的时间。

这对于有些场合是不可忍受的,可以配置 portfast 特性,使得计算机一接入,接口立即进

入 Forwarding。

S1(config)# int f0/5

S1(config-if)# spanning-tree portfast

%Warning: portfast should only be enabled on ports connected to a single

host. Connecting Hubs, concentrators, switches, bridges, etc... to this

interface when portfast is enabled, can cause temporary bridging loops.

Use with CAUTION

%Portfast has been configured on FastEthernet0/5 but will only

have effect when the interface is in a non-trunking mode.

//交换机会警告该接口只能用于接入计算机或者路由器,不要接入其他的交换机

(2) 步骤 2:配置 uplinkfast

先确认实验 1 的 STP 树已经正确。在图 中的 S1 上,关闭 f0/15 接口,在 S3 上反

复执行“ show spanning-tree vlan 1 brief”观察 f0/2 接口的状态变化:

FastEthernet0/2 128.2 128 3019 LIS 19 8193 0018.ba11.eb80 128.17

大约 15 秒后变为:

FastEthernet0/2 128.2 128 3019 LRN 19 8193 0018.ba11.eb80 128.17

FastEthernet0/2 128.2 128 3019 LRN 19 8193 0018.ba11.eb80 128.17

大约 15 秒后变为:

FastEthernet0/2 128.2 128 3019 FWD 19 8193 0018.ba11.eb80 128.17

合计大约 15+15=30 秒,f0/2 变为转发状态。

S3(config)# spanning-tree uplinkfast

S1(config)# int f0/15

S1(config-if)# no shutdown

S1(config-if)# shutdown //等 STP 重新稳定后,才执行该语句

在 S3 上重复执行“ show spanning-tree vlan 1 brief”,可以看到 f0/2 很快就进入了

Forwarding 状态。

【技术要点】没有配置 uplinkfast 时,交换机 S3 如果能直接检测到 f0/1 接口上的链路故

障,f0/2 会立即进入 Listen 状态,这样 30 秒就能进入 Forward 状态。然而如果 S1 和 S3

之间存在一个 Hub,S1 上的 f0/15 接口故障了,S3 将无法直接检测到故障,S3 只能等待 10

个周期没有收到 S1 的 BPDU(每个周期 2 秒),20 秒中后,S3 的 f0/2 才进入 Listen 状态,

这样总共 50 秒才就能进入 Forward 状态。所以 STP 重新收敛的时间通常需要 30—50 秒。

(3) 步骤 3:配置 backbonefast

打开 S1 上 f0/15 接口,确认 STP 树已经正确。在图 中的 S1 上,关闭 f0/13 接口,

在 S3 上反复执行“ show spanning-tree vlan 1 brief”观察 f0/2 接口的状态变化:

FastEthernet0/2 128.2 128 3019 BLK 19 8193 0018.ba11.eb80 128.17

大约 20 秒后变为:

FastEthernet0/2 128.2 128 3019 LIS 19 8193 0018.ba11.eb80 128.17

大约 15 秒后变为:

FastEthernet0/2 128.2 128 3019 LRN 19 8193 0018.ba11.eb80 128.17

FastEthernet0/2 128.2 128 3019 LRN 19 8193 0018.ba11.eb80 128.17

大约 15 秒后变为:

FastEthernet0/2 128.2 128 3019 FWD 19 8193 0018.ba11.eb80 128.17

合计大约 20+15+15=50 秒,f0/2 变为转发状态。

S1(config)# spanning-tree backbonefast

S2(config)# spanning-tree backbonefast

S3(config)# spanning-tree backbonefast

S1(config)# int f0/13

S1(config-if)# no shutdown

S1(config-if)# shutdown //等 STP 重新稳定后,才执行该语句

在 S3 上重复执行“ show spanning-tree vlan 1 brief”,可以看到 f0/2 很快就进入了

Listening 状态,合计大约 15+15=30 秒后,f0/2 就变为转发状态,比之前的 50 秒少了

20 秒。

【提示】uplinkfast 命令只需要在 S3 配置即可,而 backbonefast 命令需要在 S1、S2、S3

三台交换机上都配置。

以下是华为数通路由交换方向完整技术分享,欢迎对华为网络技术感兴趣的小伙伴们订阅。

【可在专栏中进行查看订阅】

华为新版HCIA数通路由交换

华为新版HCIP数通路由交换

华为新版HCIE数通路由交换

,