06.Switching+Basics+-+STP+Principles

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 40

Objectives

After completing this course, you will be able to:


• Understand basic Spanning Tree Protocol (STP) concepts.
• Understand the STP computation process.
• Master basic STP configurations.
• Understand STP improvements in Multiple Spanning Tree Protocol (MSTP).
• Master basic MSTP configurations.
Background of Spanning Tree Techniques

Faulty points
SW1

SW2

• Switches are connected over a single link to the network.


Redundancy is not deployed for the user-to-network link or
upstream devices. Once a link or upstream device fails,
services are interrupted.
Background of Spanning Tree Techniques

SW1 SW2

Loop

SW3

• Redundancy topology prevents a single point of failure, but results in a Layer 2 loop.
• Layer 2 loops also occur on the live network due to negligence.
• Layer 2 loops are harmful to the network.
Loop-induced Problem - Broadcast Storms

SW1 SW2

Broadcast

SW3

• If a Layer 2 loop occurs on a network, a broadcast data frame keeps being


flooded by switches, resulting in a broadcast storm.
• The broadcast storm consumes a huge number of device resources and network
bandwidth resources, causing network breakdown.
Loop-induced Problem - Broadcast Storms

MAC address flapping


SW2

Server SW1 Learning MAC addresses


Learning
MAC addresses

SW3 PC

1. A PC sends a data frame to a Server.


2. SW3 has not entry matching the destination MAC address in the MAC address table and floods the data frame.
3. SW1 and SW2 receive the data frame, learn the source MAC address, and flood the data frame. SW1 and SW2
receive the data frame again through another port and update entries. The process repeats.
Complex Redundancy Topology Containing More Physical Layer 2 Loops

How to prevent Layer 2 loops with


network redundancy deployed?
Basic Spanning Tree Concepts

SW1 SW2

STP blocked

SW3

The spanning tree technique can be deployed to prevent Layer 2 loops. If in a


loop occurs on the network, STP blocks a specific port to break the loop and
converges rapidly if network topology changes to ensure network redundancy.
Basic Spanning Tree Concepts (in Case of a Network Fault)

SW1 SW2

STP unblocked

SW3

When the network topology changes, STP can automatic converge and adjust the port
status, so as to ensure that the network redundancy.
STP Operations

1. Elects a root bridge on each switching network.


2. Elects a root port on each non-root bridge.
3. Elects a designated port on each segment.
4. Blocks non-designated ports.

Root
Port1 Port1
SW1 100BASE-T
SW2

Po r t2

10
rt2 -T
Po

BA
E
AS

SE
B
10

-T
Po r t2
Root port
rt
1 Po
STP blocked
Designated port

SW3
BPDUs

• STP is running by flooding bridge protocol data units


(BPDUs).

BPDU

Port1 Port1
SW1 SW2
Po t2
rt2 r
Po
BP

U
DU Po 2

PD
rt ort

B
1 P

SW3
BPDUs
Byte Field Description
2 Protocol An upper-layer protocol. The value is fixed at 0.
1 Version The value is fixed at 0 for 802.1D.
BPDU type:
1 Type • 0: configuration BPDUs
• 80: topology change notification (TCN) BPDUs
• Least-significant valid bit: topology change (TC) flag
1 Flags
• Most-significant valid bit: topology change acknowledgment (TCA) flag
8 Root ID Bridge ID of a root bridge.
4 Path cost STP cost of a path to a root bridge.
8 Bridge ID ID of the BPDU sending bridge
2 Port ID Port ID (in the format of priority + port number) of a bridge sending BPDUs
Number of seconds elapsed since a BPDU is sent. The value decreases by 1 at each
2 Message age
bridge. The value is equal to the number of hops on a path to a root bridge.
If a bridge does not receive any BPDU and the Max age time elapses, the bridge
2 Max age
considers the link connected to the port faulty. The default value is 20s.
2 Hello time Interval at which a root bridge sends BPDUs. The default value is 2s.
2 Forwarding delay Period of time elapsed in the Listening and Learning states. The default value is 15s.
Key Configuration BPDU Parameters

Field Description

ID of a root bridge that a switch sending the configuration BPDU


Root Identifier
expects to be.

The total cost of the shortest path from a switch sending a


configuration BPDU to a root switch. The total cost includes the
Root Path Cost
cost of the root switch's port and excludes the cost of the switch
port that sends the configuration BPDU.

Bridge Identifier ID of an STP switch that sends a configuration BPDU.


Port Identifier ID of an STP switch port that sends a configuration BPDU.

Sequence in comparison: Root Identifier > Root Path Cost > Bridge Identifier > Port Identifier
A smaller value indicates a higher priority.
Bridge ID

• A bridge ID is 8 bytes long. It consists of a 2-byte priority field and a 6-byte MAC
address field.
• The default bridge priority is 32768. The bridge priority can be manually modified.
• The MAC address is the backplane's MAC address on the switch.
• A switch with the smallest bridge ID on the network becomes the root bridge.

Bridge ID

Priority MAC address

2 bytes 6 bytes
Path Cost

• The path cost is set on a port and used by STP or Rapid Spanning Tree Protocol (RSTP) to
select links.
• The default path cost and value range are determined by a selected path cost algorithm. The
path cost is inversely proportional to the port bandwidth.
• Huawei network devices calculate the path cost in compliance with 802.1d-1998, 802.1t, or
Huawei-proprietary legacy standard.Huawei switches conforms to 802.1t by default.

Bandwidth 802.1t
10 Mbps 2,000,000
100 Mbps 200,000
1000 Mbps 20,000
10,000 Mbps 2,000
Path Cost

Root GE0/0/0 FE0/0/0


Cost = 20000 Cost = 200000

SW1 SW2 SW3

BPDU BPDU BPDU


Cost = 0 Cost = 0 + 20000 Cost = 20000 + 200000
Port ID

• Port ID (2 bytes) = Port priority (1 byte) + Port number (1 byte)


• The default priority is 128. The value is an integer ranging from 0 to 255. A smaller value
indicates a higher priority.

Port ID

Priority Port number

1 bytes 1 bytes
STP Operations

1.STP elects a root switch on each switching network.


A switch with the smallest bridge ID on a network is elected as a root bridge.

Priority 32768 BPDU Priority 32768


MAC 0c00.000a.0001 MAC 0c00.000a.0002
Port1 100BASE-T Port1
SW1 SW2
Po
rt r t2
2
-T Po

10
E

BA
A S

SE
B
10 U

-T
PD
BP
Po 2
rt B
DU
rt o
1 P
Priority 32768
MAC 0c00.000a.0003
SW3
STP Operations

1.STP elects a root switch on each switching network.


2.STP elects a root port on each non-root bridge.

Root

SW1 Port1 100BASE-T Port1


SW2
Po
rt r t2
2
-T Po

10
E

BA
AS

SE
B
Po 10

-T
rt1 2
ort
Root port P
Designated port

SW3
STP Operations

1.STP elects a root switch on each switching network.


2.STP elects a root port on each non-root bridge.
3.STP elects a designated port on each segment.

Root
Port1 100BASE-T Port1
SW1 SW2
Po
rt
2 r t2
-T Po

10
E

BA
AS

SE
B
10

-T
Po
rt1 r t2
Root port Po
Designated port

SW3
STP Operations

1.STP elects a root switch on each switching network.


2.STP elects a root port on each non-root bridge.
3.STP elects a designated port on each segment.
4.STP selects a non-designated port, which to be blocked.
Root
Port1 100BASE-T Port1
SW1 SW2
Po
rt r t2
2 -T Po

10
E

BA
AS

SE
B
10

-T
Po t2
rt r
Root port
1 Po
STP blocked
Designated port

SW3
STP Port Status

A port in the Disabled state does not forward BPDUs or user traffic. The
Disable
port is Down.

• A port in Blocking state receives and processes BPDUs, but does not
forward user traffic or learn MAC addresses.
Blocking
• If the default Max age (20s) timer expires and the port does not
receive any BPDU, the port switches to the Listening state.

The port in the Listening state receives and sends BPDUs, but does not
Listening receive or forward user traffic or learn MAC addresses.
Port roles are determined, and election is to be performed.

The port in the Learning state receives and sends BPDUs and learns
Learning
MAC addresses, but does not receive or forward user traffic.

The port in the Forwarding state receives and forwards frames, receives
Forwarding
and sends BPDUs, and learns MAC addresses.
STP Topology Change Mechanism

Root

TCN BPDU 3

4 TCN ACK
Switch C
2 TCN BPDU
3

TCN ACK
1
Detects a link fault
Switch B

Switch A
STP Topology Change Mechanism

Root 5 TC flag = 35s

TCN BPDU 5 5

5 5
5
STP Topology Change Mechanism

Root

CAM entry lifetime = 15s 6 6 CAM entry lifetime = 15s

6 6 6

CAM entry lifetime = 15s CAM entry lifetime = 15s CAM entry lifetime = 15s
Basic STP Configuration

• A spanning tree protocol is specified. The value can be STP, RSTP, or MSTP.
[SW] stp mode { stp | rstp | mstp } # The default setting is MSTP.
• Set a switch priority.
[SW] stp priority pri # The default value is 32768.
• Configure the switch as the root bridge.
[SW] stp root primary
• Configure the switch as the secondary root bridge.
[SW] stp root secondary
• Enable the spanning tree.
[SW] stp enable
• Set a port STP priority.
[SW] port GigabitEthernet0/0/24
[SW-GigabitEthernet0/0/24] stp priority priority
• Set the path cost on the port.
[SW] port GigabitEthernet0/0/24
[SW-GigabitEthernet0/0/24] stp cost cost
Question 1: Does a Spanning Tree Protocol Need to Be Activated?

No loop No loop Loop generated


Problem 2: Does a Loop Occur in the Following Environment?

Trunk permit VLAN10 Trunk permit VLAN10

VLAN10
VLAN10
VLAN20

Trunk permit VLAN10 Trunk permit VLAN20

Loop Loop

Figure 1 Figure 2
Problem 3: Does a Loop Occur in the Following Environment?

A B
VLAN 30 SW2
SW1
B A
VLAN10

VLAN20
A B

SW3 SW4
B VLAN 40 A

No
Loop

Figure 3
STP Drawbacks

SW1 Da SW2
t a
of
all
V LA After SW3's upstream port on the right is
Ns blocked by STP, traffic of all VLANs has to
STP Blocked travel through the left link. The link on the
right of SW3 carries no traffic. This is
because all VLANs share the same
SW3 spanning tree.
VLANs 10, 20, 30, 40 …
Optimization Solution

SW1 SW2
Per-VLAN STP

If running based on the VLAN on the switch of spanning


tree to solve the preceding problem occurs because the
spanning tree is per-VLAN, then we can be flexible set
corresponding to each VLAN spanning tree of the blocked
SW3 port, implementing data load balancing.
VLANs 10, 20, 30, 40 … If a great number of VLANs exist on a network, spanning
tree computation for each VPN consumes a huge number
of switch processor resources.
Optimization Solution

SW1 VL SW2
AN Data of 0

s 1 of a ta 0, 4
0, D 2
30 Ns A better method is to map a VLAN to a
… LA
V spanning tree instance to allow several
Instance 2 Instance 1 VLANs to share a spanning tree. This
blocked blocked method tackles the two problems.

SW3
VLANs 10, 20, 30, 40 …
MSTP

• MSTP is compatible with STP and RSTP. MSTP uses multiple instances to isolate service
traffic and user traffic and provides multiple redundant paths for data forwarding and VLAN
data load balancing.

• In MSTP, several VLANs are mapped to an instance. MSTP runs a spanning tree for each
instance. The parameters, such as priorities and path costs can be set in each instance.
MSTP Configuration Example

SW1 SW2
Primary root of instance 1 Secondary root of instance 1
GE0/0/24 GE0/0/24
Secondary root of instance 2 primary root of instance 2
G 2 2
E0 0/
/ /
0/
21 E0
G
G 2 2
E0 0/
/ /
0/
21 E0
G

Instance 2 blocked
SW3
Instance 1 bocked VLANs 10, 20, 30, 40
Instance 1 vlan 10 20
Instance 2 vlan 30 40
MSTP Configuration Example: SW1

[SW1] VLAN batch 10 20 30 40

[SW1] stp mode mstp # Set the spanning tree protocol to MSTP.

[SW1] stp region-configuration # Access the MSTP configuration view.

[SW1-mst-region] region-name huawei # Set the MSTP region name to huawei.

[SW1-mst-region] instance 1 VLAN 10 20 # Map VLANs to an MSTP instance.

[SW1-mst-region] instance 2 VLAN 30 40 # Map VLANs to another MSTP instance.

[SW1-mst-region] active region-configuration # Activate the MST region.

[SW1-mst-region] quit
MSTP Configuration Example: SW1

# Set the priority of each instance and configure SW1 as the primary root bridge of instance 1 and the
secondary root bridge of instance 2.
[SW1] stp instance 1 root primary # Or, run: stp instance 1 priority 0
[SW1] stp instance 2 root secondary # Or, run: stp instance 2 priority 4096
[SW1] stp enable # Enable STP.
#
[SW1] port GigabitEthernet0/0/24
[SW1-GigabitEthernet0/0/24] port link-type trunk
[SW1-GigabitEthernet0/0/24] port trunk allow-pass VLAN 10 20 30 40
[SW1] port GigabitEthernet0/0/21
[SW1-GigabitEthernet0/0/21] port link-type trunk
[SW1-GigabitEthernet0/0/21] port trunk allow-pass VLAN 10 20 30 40
MSTP Configuration Example: SW2

[SW2] VLAN batch 10 20 30 40

[SW2] stp mode mstp # Set the spanning tree protocol to MSTP.

[SW2] stp region-configuration # Access the MSTP configuration view.

[SW2-mst-region] region-name huawei # Set the MSTP region name to huawei.

[SW2-mst-region] instance 1 VLAN 10 20 # Map VLANs to an MSTP instance.

[SW2-mst-region] instance 2 VLAN 30 40 # Map VLANs to an MSTP instance.

[SW2-mst-region] active region-configuration # Activate the MST region.

[SW2-mst-region] quit
MSTP Configuration Example: SW2

# Set the priority of each instance and configure SW2 as the primary root bridge of instance 2 and the
secondary root bridge of instance 1.
[SW2] stp instance 1 root secondary
[SW2] stp instance 2 root primary
[SW2] stp enable
#
[SW2] port GigabitEthernet0/0/24
[SW2-GigabitEthernet0/0/24] port link-type trunk
[SW2-GigabitEthernet0/0/24] port trunk allow-pass VLAN 10 20 30 40
[SW2] port GigabitEthernet0/0/22
[SW2-GigabitEthernet0/0/22] port link-type trunk
[SW2-GigabitEthernet0/0/22] port trunk allow-pass VLAN 10 20 30 40
MSTP Configuration Example: SW3

[SW3] VLAN batch 10 20 30 40

[SW3] stp mode mstp

[SW3] stp region-configuration

[SW3-mst-region] region-name huawei

[SW3-mst-region] instance 1 VLAN 10 20

[SW3-mst-region] instance 2 VLAN 30 40

[SW3-mst-region] active region-configuration

[SW3-mst-region] quit

# Use the default priority of 32768 for an MSTP instance on SW3.


MSTP Configuration Example: SW3

[SW3] port GigabitEthernet0/0/22

[SW3-GigabitEthernet0/0/22] port link-type trunk

[SW3-GigabitEthernet0/0/22] port trunk allow-pass VLAN 10 20 30 40

[SW3] port GigabitEthernet0/0/21

[SW3-GigabitEthernet0/0/21] port link-type trunk

[SW3-GigabitEthernet0/0/21] port trunk allow-pass VLAN 10 20 30 40


Configuration Results

SW1 SW2 SW1 SW2


GE0/0/24 GE0/0/24

G G
E0 E0
/0 2 2 /0 / 22
/2 0/ /2 /0
1
E 0/ Instance 2 1
E0
G blocked G

Instance 1
blocked
SW3 SW3

VLAN 10 and VLAN 20 VLAN 30 and VLAN 40


traffic traffic

You might also like