---
title: STP
slug: aidc/stp
createdAt: 2025-12-01T11:11:06.000Z
---

## <font color="#1d50a2">STP View</font>

<font color="#1d05a2">Table 1 STP View</font>

| **Command**                                                                                         | **Purpose**                                                                         |
| --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| **show mstp bridge**                                                                                | Display MSTI status.                                                                |
| **show mstp brief** \[\{*ethernet\|link-aggregation*} *interface\_name*]                            | Display information about the port status in CIST.                                  |
| **show mstp interface** \[\{*ethernet\|link-aggregation*} *interface\_name*]                        | Display detailed information about the status of the ports in CIST.                 |
| **show mstp mstconfid**                                                                             | Display summary information about the MST domain configuration currently in effect. |
| **show mstp status**                                                                                | Display status of MSTP.                                                             |
| **show mstp tree** *instance-id*                                                                    | Display MSTI status of the specified MSTP instance.                                 |
| **show mstp treeport** \{*ethernet\|link-aggregation*} *interface\_name* **instance** *instance-id* | Displays MSTI port status details.                                                  |

### <font color="#1d50a2">show mstp bridge</font>

**\[Command]**
**show mstp bridge**

**\[Purpose]**
Display MSTI status.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mstp bridge
Bridge CIST info
  enabled yes
  bridge id 8.000.00:00:01:02:03:04
  designated root 8.000.00:00:01:02:03:04
  regional root 8.000.00:00:01:02:03:04
  root port none
  path cost 0 internal path cost 0
  max age 20 bridge max age 20
  forward delay 15 bridge forward delay 15
  tx hold count 6 max hops 20
  hello time 2 ageing time 300
  force protocol version mstp
  time since topology change 2497
  topology change count 9
  topology change no
  topology change port Ethernet64
  last topology change port PortChannel0111
```

### <font color="#1d50a2">show mstp brief \[\{ethernet|link-aggregation\} *interface\_name*\]</font>

**\[Command]**
**show mstp brief** \[\{**ethernet|link-aggregation**} *interface\_name*]

**\[Purpose]**
Display information about the status of ports in CIST.

**\[Parameters]**

| **Parameter**     | **Description** |
| ----------------- | --------------- |
| *interface\_name* | interface name  |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mstp brief
port bridge point-to-point oper-edge-port port-id enabled state role designated-bridge designated-port designated-root
--------------- -------- ---------------- ---------------- --------- --------- ---------- ---------- ----------------------- ----------------- -----------------------
0/8 Bridge yes yes 8.002 yes forwarding Designated 8.000.60:EB:5A:01:06:6D 8.002 8.000.60:EB:5A:01:06:6D
lag111 Bridge no no 8.003 no discarding Disabled 8.000.60:EB:5A:01:06:6D 0 8.000.60:EB:5A:01:06:6D
```

### <font color="#1d50a2">show mstp interface \[\{ethernet|link-aggregation\} *interface\_name*\]</font>

**\[Command]**
**show mstp interface** \[\{**ethernet|link-aggregation**} *interface\_name*]

**\[Purpose]**
Display detailed information about the status of the ports in CIST.

**\[Parameters]**

| **Parameter**     | **Description** |
| ----------------- | --------------- |
| *interface\_name* | interface name  |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mstp interface
Bridge:0/2 CIST info
  enabled            no                      role                 Disabled
  port id            8.006                   state                discarding
  external port cost 200000000               admin external cost  0
  internal port cost 200000000               admin internal cost  0
  designated root    8.000.60:EB:5A:01:10:C9 dsgn external cost   0
  dsgn regional root 8.000.60:EB:5A:01:10:C9 dsgn internal cost   0
  designated bridge  8.000.60:EB:5A:01:10:C9 designated port      0.000
  admin edge port    no                      auto edge port       yes
  oper edge port     no                      topology change ack  no
  point-to-point     no                      admin point-to-point auto
  restricted role    no                      restricted TCN       no
  port hello time    2                       disputed             no
  bpdu guard port    no                      bpdu guard error     no
  network port       no                      BA inconsistent      no
  bpdu filter port   no                      Num RX BPDU Filtered 0
  Num TX BPDU        0                       Num TX TCN           0
  Num RX BPDU        0                       Num RX TCN           0
  Num Transition FWD 0                       Num Transition BLK   1
  Rcvd BPDU          no                      Rcvd STP             no
  Rcvd RSTP          no                      Send RSTP            yes
  Rcvd TC Ack        no                      Rcvd TCN             no
```

### <font color="#1d50a2">show mstp mstconfid</font>

**\[Command]**
**show mstp mstconfid**

**\[Purpose]**
Display summary information about the MST domain configuration currently in effect.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mstp mstconfid
Bridge MST Configuration Identifier:
  Format Selector: 0
  Configuration Name: test
  Revision Level: 0
  Configuration Digest: F3B784B6F462AE5FE28E6578DBF77D2E
```

### <font color="#1d50a2">show mstp status</font>

**\[Command]**
**show mstp status**

**\[Purpose]**
Display status of MSTP.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mstp status
role Flags: Root - Root, Desg - Designated, Altn - Alternate, Back - Backup, Mstr - Master, Disa - Disabled
state Flags: disc - Discard/Blocking/Listening,  lear - Learning, forw - Forwarding
Spanning-tree Mode: mstp
vlan       mst instance  port_role_state
-------  --------------  -------------------------------------------------------
vlan10                0  lag5(Desg)(forw) lag9(Desg)(forw)
vlan20                0
```

### <font color="#1d50a2">show mstp tree *instance-id*</font>

**\[Command]**
**show mstp tree** *instance-id*

**\[Purpose]**
Display MSTI status of the specified MSTP instance.

**\[Parameters]**

| **Parameter** | **Description**   |
| ------------- | ----------------- |
| *instance-id* | MSTP instance ID. |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mstp tree 0
Bridge MSTI 0 info
  bridge id 8.000.00:00:01:02:03:04
  regional root 8.000.00:00:01:02:03:04
  root port none
  internal path cost 0
  time since topology change 2560
  topology change count 9
  topology change no
  topology change port Ethernet64
  last topology change port PortChannel0111
sonic# show mstp tree 1
Bridge MSTI 1 info
  bridge id 8.001.00:00:01:02:03:04
  regional root 8.001.00:00:01:02:03:04
  root port none
  internal path cost 0
  time since topology change 2563
  topology change count 9
  topology change no
  topology change port Ethernet64
  last topology change port PortChannel0111
```

### <font color="#1d50a2">show mstp treeport \{ethernet|link-aggregation\} *interface\_name* instance *instance-id*</font>

**\[Command]**
**show mstp treeport** \{**ethernet|link-aggregation**} *interface\_name* **instance** *instance-id*

**\[Purpose]**
Displays MSTI port status details.

**\[Parameters]**

| **Parameter**     | **Description**  |
| ----------------- | ---------------- |
| *interface\_name* | interface name   |
| *instance-id*     | MSTP instance ID |

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show mstp treeport ethernet 0/64 instance 1
Bridge:0/64 MSTI 1 info
  role Designated port id 8.00A
  state forwarding disputed no
  internal port cost 200 admin internal cost 0
  dsgn regional root 8.001.00:00:01:02:03:04 dsgn internal cost 0
  designated bridge 8.001.00:00:01:02:03:04 designated port 8.00A
sonic# show mstp treeport ethernet 0/64 instance 3
Bridge:0/64 MSTI 3 info
  role Root port id 8.00A
  state forwarding disputed no
  internal port cost 200 admin internal cost 0
  dsgn regional root 0.003.60:EB:5A:01:14:CC dsgn internal cost 0
  designated bridge 0.003.60:EB:5A:01:14:CC designated port 8.004
```

## <font color="#1d50a2">STP Config</font>

<font color="#1d05a2">Table 2 STP Config</font>

| **Command**                                                                                       | **Purpose**                                                             |
| ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| **bridge mac** *HH\:HH\:HH\:HH\:HH*:HH                                                            | Configure Bridge MAC address.                                           |
| **mstp enable**                                                                                   | Enable MSTP globally.                                                   |
| **mstp** \{**forward\_delay\|hello\|max\_age\|name**} *value*                                     | Set the attributes of MSTP.                                             |
| **mstp cost interface \{ethernet\|link-aggregation}** *interface\_name* *cost\_value*             | Set the external path cost.                                             |
| **mstp instance** *instance-id*                                                                   | Create a MSTP instance and enter MSTP Instance Configuration View.      |
| **priority** *priority*                                                                           | Set the priority of the MSTP instance.                                  |
| **interface priority** *priority* **interface** \{*ethernet\|link-aggregation*} *interface\_name* | Set the interface priority of all member ports under the MSTP instance. |
| **vlan** *vlan-id* (MSTP Instance Configuration View)                                             | Bind the VLAN to the MSTP instance.                                     |
| **mstp cost interface \{ethernet\|link-aggregation}** *interface\_name* *cost\_value*             | Set the internal path csot of the instance.                             |
| **mstp auto-edge enable interface \{ethernet\|link-aggregation}** *interface\_name*               | Enable MSTP auto edge for the interface.                                |
| **mstp edge-port enable interface \{ethernet\|link-aggregation}** *interface\_name*               | Enable MSTP manual edge for the interface.                              |
| **mstp bpdu-filter enable interface \{ethernet\|link-aggregation}** *interface\_name*             | Enable BPDU filtering for the interface.                                |
| **mstp bpdu-guard enable interface** \{*ethernet\|link-aggregation*} *interface\_name*            | Enable BPDU guard for the interface.                                    |

### <font color="#1d50a2">bridge mac *HH\:HH\:HH\:HH\:HH\:HH*</font>

**\[Command]**
**bridge mac** *HH\:HH\:HH\:HH\:HH\:HH*

**\[Purpose]**
Configure Bridge MAC address.

**\[Parameters]**

| **Parameter**           | **Description** |
| ----------------------- | --------------- |
| *HH\:HH\:HH\:HH\:HH*:HH | MAC address.    |

**\[View]**
Global Configuration View

**\[Notes]**
The default is the MAC of the switch;
Run command **no bridge mac** to restore the Bridge MAC address to default.

**\[Use Cases]**

```plaintext
sonic(config)# bridge mac 00:44:55:66:77:88
```

### <font color="#1d50a2">mstp enable</font>

**\[Command]**
**mstp enable**

**\[Purpose]**
Enable MSTP globally.

**\[View]**
Global Configuration View

**\[Notes]**
Run command **mstpdisable** to disable MSTP.

**\[Use Cases]**

```plaintext
sonic(config)# mstp enable
```

### <font color="#1d50a2">mstp \{forward\_delay|hello|max\_age|name\} *value*</font>

**\[Command]**
**mstp** \{**forward\_delay**|**hello**|**max\_age**|**name**} *value*

**\[Purpose]**
Set the attributes of MSTP.

**\[Parameters]**

| **Parameter**      | **Description**                                                                                |
| ------------------ | ---------------------------------------------------------------------------------------------- |
| **forward\_delay** | Specify the port state changing time in seconds. The range is \[4,30], and the default is 15.  |
| **hello**          | Specify the interval of sending BPDUs in seconds. The range is \[1,10], and the default is 2.  |
| **max\_age**       | Specify the maximum aging value in seconds. The range is \[10,1000000], and the default is 20. |
| **name**           | Specify the domain name of the Bridge in string form.                                          |
| *value*            | The value of the attribute.                                                                    |

**\[View]**
Global Configuration View

**\[Notes]**
MSTP should be enabled before configuration.
Run command **no mstp** \{**forward\_delay**|**hello**|**max\_age**|**name**} to restore to default configuration.

**\[Use Cases]**

```plaintext
sonic(config)# mstp hello 5
sonic(config)# mstp name region1
```

### <font color="#1d50a2">mstp cost interface \{ethernet|link-aggregation\} *interface\_name* *cost\_value*</font>

**\[Command]**
**mstp cost interface** \{**ethernet**|**link-aggregation**} *interface\_name cost\_value*

**\[Purpose]**
Set the external path cost.

**\[Parameters]**

| **Parameter**     | **Description**                                   |
| ----------------- | ------------------------------------------------- |
| *interface\_name* | Interface name (eg.0/1)                           |
| *cost\_value*     | Specify the cost, and the range is \[1,200000000] |

**\[View]**
Global Configuration View

**\[Notes]**
MSTP should be enabled before configuration.
The default cost can be calculated as: cost = 200000000 / link speed (in 100Kbps).
Run command **no mstp cost interface** \{**ethernet**|**link-aggregation**} *interface\_name* to restore to default cost.

**\[Use Cases]**

```plaintext
sonic(config)# mstp cost interface ethernet 0/0 10
```

### <font color="#1d50a2">mstp instance *instance-id*</font>

**\[Command]**
**mstp instance** *instance-id*

**\[Purpose]**
Create a MSTP instance and enter MSTP Instance Configuration View.

**\[Parameters]**

| **Parameter** | **Description**                         |
| ------------- | --------------------------------------- |
| *instance-id* | MSTP instance ID, the range is \[0,63]. |

**\[View]**
Global Configuration View

**\[Notes]**
MSTP should be enabled before configuration.
Instance 0 is the default instance, cannot be created or deleted.
Run command **no mstp instance** *instance-id* to delete MSTP instance.

**\[Use Cases]**

```plaintext
sonic(config)# mstp instance 2
sonic(config-mstp-instance-2)#
```

### <font color="#1d50a2">priority *priority*</font>

**\[Command]**
**priority** *priority*

**\[Purpose]**
Set the priority of the MSTP instance.

**\[Parameters]**

| **Parameter** | **Description**                                                                                                               |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| *priority*    | Specify the priority of the instance, the range is \[0,15]. The default is 8. The smaller the value, the higher the priority. |

**\[View]**
MSTP Instance Configuration View

**\[Notes]**
MSTP should be enabled before configuration.
Run command **no priority** to restore to default priority.

**\[Use Cases]**

```plaintext
sonic(config)# mstp instance 2
sonic(config-mstp-instance-2)# priority 1
```

### <font color="#1d50a2">interface priority *priority* interface \{ethernet|link-aggregation\} *interface\_name*</font>

**\[Command]**
**interface priority** *priority* **interface** \{**ethernet**|**link-aggregation**} *interface\_name*

**\[Purpose]**
Set the interface priority under the MSTP instance.

**\[Parameters]**

| **Parameter** | **Description**                                                                                                                 |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| *priority*    | Specify the priority of the interfaces, the range is \[0,15]. The default is 8. The smaller the value, the higher the priority. |

**\[View]**
MSTP Instance Configuration View

**\[Notes]**
MSTP should be enabled before configuration.
Run command **no interface priority interface \{ethernet|link-aggregation}** *interface\_name* to restore to default priority.

**\[Use Cases]**

```plaintext
sonic(config)# mstp instance 2
sonic(config-mstp-instance-2)# interface priority 1 interface ethernet 0/0
```

### <font color="#1d50a2">vlan *vlan-id* (MSTP Instance Configuration View)</font>

**\[Command]**
**vlan** *vlan-id*

**\[Purpose]**
Bind the VLAN to the MSTP instance.

**\[Parameters]**

| **Parameter** | **Description**                  |
| ------------- | -------------------------------- |
| *vlan-id*     | VLAN ID, the range is \[1,4094]. |

**\[View]**
MSTP Instance Configuration View

**\[Notes]**
MSTP should be enabled before configuration.
Run command **no vlan** *vlan-id* to unbind the VLAN from the MSTP instance.

**\[Use Cases]**

```plaintext
sonic(config)# mstp instance 2
sonic(config-mstp-instance-2)# vlan 100
```

### <font color="#1d50a2">cost interface \{ethernet|link-aggregation\} *interface\_name* *cost\_value*</font>

**\[Command]**
**cost interface** \{**ethernet**|**link-aggregation**} *interface\_name cost\_value*

**\[Purpose]**
Set the internal path csot of the instance.

**\[Parameters]**

| **Parameter**     | **Description**                                   |
| ----------------- | ------------------------------------------------- |
| *interface\_name* | Interface name (eg.0/1)                           |
| *cost\_value*     | Specify the cost, and the range is \[1,200000000] |

**\[View]**
MSTP Instance Configuration View

**\[Notes]**
MSTP should be enabled before configuration.
The default cost can be calculated as: cost = 200000000 / link speed (in 100Kbps).
Run command **no cost interface** \{**ethernet**|**link-aggregation**} *interface\_nam* to restore to default cost.

**\[Use Cases]**

```plaintext
sonic(config)# mstp instance 0
sonic(config-mstp-instance-0)# cost interface ethernet 0/0 10
```

### <font color="#1d50a2">mstp auto-edge enable interface \{ethernet|link-aggregation\} *interface\_name*</font>

**\[Command]**
**mstpauto-edge enable interface** \{**ethernet**|**link-aggregation**} *interface\_name*

**\[Purpose]**
Enable MSTP auto edge for the interface.

**\[Parameters]**

| **Parameter**     | **Description**         |
| ----------------- | ----------------------- |
| *interface\_name* | Interface name (eg.0/1) |

**\[View]**
Global Configuration View

**\[Notes]**
The auto-edge interface feature is enabled by default on all Layer 2 ports.
An interface with auto-edge enabled does the following things when its state changes from down to up: waiting for 3 seconds and trying to receive BPDUs; If no BPDU is received, it becomes an edge port and will lose edge port role the first time it receives a BPDU thereafter.
Run command **mstp auto-edge disable interface** \{**ethernet**|**link-aggregation**} *interface\_name* to disable auto edge port, after that, if you do not assign it as a manual edge port, it will lose edge port role.

**\[Use Cases]**

```plaintext
sonic(config)# mstp auto-edge enable interface link-aggregation 99
```

### <font color="#1d50a2">mstp edge-port enable interface \{ethernet|link-aggregation\} *interface\_name*</font>

**\[Command]**
**mstp edge-port enable interface** \{**ethernet**|**link-aggregation**} *interface\_name*

**\[Purpose]**
Enable MSTP manual edge for the interface.

**\[Parameters]**

| **Parameter**     | **Description**         |
| ----------------- | ----------------------- |
| *interface\_name* | Interface name (eg.0/1) |

**\[View]**
Global Configuration View

**\[Notes]**
Manual edge port is disabled by default on all Layer 2 ports.
When a manual edge port is enabled on an interface, it immediately becomes an edge port until it receives a BPDU message.
The priority of manual edge port configuration is higher than auto edge port, that is, when manual edge port is enabled, auto edge port configuration is invalid.
Run command **mstp edge-port disable interface** \{**ethernet**|**link-aggregation**} *interface\_name* to disable MSTP manual edge port feature.

**\[Use Cases]**

```plaintext
sonic(config)# mstp edge-port enable interface link-aggregation 99
```

### <font color="#1d50a2">mstp bpdu-filter enable interface \{ethernet|link-aggregation\} *interface\_name*</font>

**\[Command]**
**mstp bpdu-filter enable interface** \{**ethernet**|**link-aggregation**} *interface\_name*

**\[Purpose]**
Enable BPDU filtering for the interface.

**\[Parameters]**

| **Parameter**     | **Description**         |
| ----------------- | ----------------------- |
| *interface\_name* | Interface name (eg.0/1) |

**\[View]**
Global Configuration View

**\[Notes]**
This command will enable MSTP at interface level and determines whether the interface participates in MSTP protocol operation.
The interface to be operated should be a Layer 2 port, and MSTP should be enabled before configuration.
By default, MSTP is enabled on all Layer 2 interfaces. After this function is enabled, the interface will not participate in MSTP protocol operation, and there will be a risk of loops, therefore, please take caution.
Run command **mstp bpdu-filter disable interface** \{**ethernet**|**link-aggregation**} *interface\_name* to disable BPDU filtering.

**\[Use Cases]**

```plaintext
sonic(config)# mstp bpdu-filter enable interface link-aggregation 99
```

### <font color="#1d50a2">mstp bpdu-guard enable interface \{ethernet|link-aggregation\} *interface\_name*</font>

**\[Command]**
**mstp bpdu-guard enable interface** \{**ethernet**|**link-aggregation**} *interface\_name*

**\[Purpose]**
Enable BPDU guard for the interface.

**\[Parameters]**

| **Parameter**     | **Description**         |
| ----------------- | ----------------------- |
| *interface\_name* | Interface name (eg.0/1) |

**\[View]**
Global Configuration View

**\[Notes]**
When the interface is enabled with BPDU message protection, it will be admin down if received a BPDU.
Run command **mstp bpdu-guard disable interface** \{**ethernet**|**link-aggregation**} *interface\_name* to disable BPDU guard.

**\[Use Cases]**

```plaintext
sonic(config)# mstp bpdu-guard enable interface link-aggregation 99
```

