118Configuring protection functionsA spanning tree device supports the following protection functions:• BPDU guard• Root guard• Loop guard• Port role restriction• TC-BPDU transmission restriction• TC-BPDU guard• BPDU dropEnabling BPDU guardFor access layer devices, the access ports can directly connect to the user terminals (such as PCs) or fileservers. The access ports are configured as edge ports to allow rapid transition. When these portsreceive configuration BPDUs, the system automatically sets the ports as non-edge ports and starts a newspanning tree calculation process. This causes a change of network topology. Under normal conditions,these ports should not receive configuration BPDUs. However, if someone forges configuration BPDUsmaliciously to attack the devices, the network will become unstable.The spanning tree protocol provides the BPDU guard function to protect the system against such attacks.When edge ports receive configuration BPDUs on a device with BPDU guard enabled, the deviceperforms the following actions:• Shuts down these ports.• Notifies the NMS that these ports have been shut down by the spanning tree protocol.The device reactivates the closed ports after a detection interval. For more information about thisdetection interval, see Fundamentals Configuration Guide.BPDU guard does not take effect on loopback-testing-enabled ports. For more information aboutloopback testing, see "Configuring Ethernet interfaces."Configure BPDU guard on a device with edge ports configured.To enable BPDU guard:Step Command Remarks1. Enter system view. system-view N/A2. Enable the BPDU guardfunction for the device. stp bpdu-protection By default, BPDU guard isdisabled.Enabling root guardThe root bridge and secondary root bridge of a spanning tree should be located in the same MST region.Especially for the CIST, the root bridge and secondary root bridge are put in a high-bandwidth coreregion during network design. However, due to possible configuration errors or malicious attacks in thenetwork, the legal root bridge might receive a configuration BPDU with a higher priority. Another device