Current location - Quotes Website - Team slogan - ENSP simulation experiment -STP configuration and routing rules
ENSP simulation experiment -STP configuration and routing rules
STP is a protocol used to avoid logical loops at the data link layer. Devices running STP discover loops through interactive information, and finally prune the network structure into loop-free tree results by blocking specific ports. When the network fails, STP can quickly find the link failure and find another path for data transmission as soon as possible.

STP running on the switch interactively selects the root switch through BPDU (Bridge Protocol Data Unit) information, then each non-root switch selects the root port to communicate with the root switch, then each network segment selects the designated port to forward data to the root switch, and finally the remaining ports are blocked.

STP function:

Eliminating loops: Eliminating possible loops in the network by blocking redundant links.

Link backup: when the active path fails, activate the backup link and restore the network in time.

By default, after the switch runs STP, the selection of root switch, root port and designated port will be based on the size of the switch MAC address, which brings uncertainty and may lead to hidden dangers. Run dis stp brief to view the port status. Without configuration, all the ports of SW 1 switch are in forwarding state, which are DESIgnated as port desi, and all SW 1 switches are root switches. The G0/0/ 1 port role of SW4 is ALTE, and the status is discarded. The G0/0/3 port role of SW3 is ALTE, and this status is discarded. The G0/0/ 1 port role of SW2, G0/0/2 port role of SW and G0/0/2 port role of SW4 are the role root ports.

STP port status of SW3:

DESI: Designated port with forwarding status;

Root: the root port, the lowest cost port in the root bridge. Each non-root bridge must select a root port with forwarding status;

ALTE: standby port, which is discarded and will not forward data traffic;

Command disttp to view the cist bridge: 32768.4c 1f-cc92-4692, that is, the global address of the switch MAC, switch ID, switch priority and MC address, 32768 is the priority of the switch, and 4c 1f-cc92-4692 is the MAC address of SW2. The first step of spanning tree operation is to select the root switch by comparing the ID of each switch. Firstly, compare the priorities of switches, and the lowest value is the root switch; If the priorities are the same, compare the MAC addresses and take the lower value as the root switch. At present, the four switches have the same priority, and 32768, SW 1 have the lowest MAC address, so they are selected as the root switch.

The STP generated by the switch by default above now needs to be configured manually.

1. Configure each switch to enable STP and change the default MSTP to normal STP.

[SW 1]stp enabled

Stp mode stp

The other three commands are the same.

2. Configure the root switch

The root switch is very important in the network, and its poor performance or the access layer switch as the root switch will affect the communication quality and data transmission of the whole network. ? The root switch is selected according to the switch ID. The smaller the value, the higher the priority. The default priority of the switch is 32768. Now SW 1 is configured as the root switch, with the priority set to 0, SW2 as the standby root switch and the priority set to 4096.

[SW 1]stp priority 0

[SW2]stp Priority 4096

Another way is to use stp root primary and stp root? Secondary priority setting has the same effect. SW 1 is the root switch with priority of 0, and SW2 is the backup root switch with priority of 4096.

3. Root port election

After selecting the root switch, the spanning tree selects the root port on each non-root switch. In the election, the cost of the path to the root switch is first compared, and the port with the smallest path is the root port. If the path cost values are the same, compare the uplink switch ID on the link where each port is located; If the uplink switch ID is the same, compare the uplink port ID of the link where each port is located. Each switch can only have one root port.

Let's analyze the root port of SW4, which is the same as the path cost. The ID of SW2 is less than that of SW3, and all g0/0/2 connected with SW2 are root ports.

Distp interface G0/0/2 View the interface overhead value. ? Config is the manually configured path cost, and Active is the actually used path cost.

Port cost (Dot 1T): configuration = automatic/active =20000.

? Manual modification? The cost of g0/0/2 interface is 1 and the cost of STP is 2000 1. Revise as follows:

Port cost (dot1t): config = 20001/active = 20001

Look at the stp port dis stp, g0/0/ 1 becomes the root port.

4. Election of designated ports

? After the root switch is selected, the spanning tree will select the designated port on each non-root switch, and the rules are similar to ports.

It is analyzed by the ports connected between SW2 SW3. At present, the G0/0/3 port of SW2 is the designated port, and the G0/0/3 port of SW3 is the replacement port. In the election, we first compare the root path costs in the sending and receiving BPDUs of two ports, and the costs of SW2 and SW3 are the same. Then we compare the bridge IDs in the sending and receiving BPDUs. The ID of SW2 (priority before MAC address) is smaller than SW3, so the G0/0/3 port of SW2 is the designated port.

? Manually modifying the g0/0/3 interface of SW2 costs 2000 1, and stp costs? 2000 1。 Revise as follows:

Port cost (dot1t): config = 20001/active = 20001

Check stp port dis stp brief again, g0/0/3 becomes the replacement port, and G0/0/3 of SW3 is the designated port.

Therefore, when selecting a specified port, first compare the root path cost, and then compare the switch ID.