Layer 2 Security · Topic 1 of 4
BPDU, Loop and Root Protection
Learn Junos BPDU protection, root protection and loop protection: what each prevents, the bpdu-block-on-edge, no-root-port and loop-protect statements.
- 5 min
- BPDU protection: edge ports that receive a BPDU are disabled;
bpdu-block-on-edge. disable-timeoutunderprotocols layer2-control bpdu-blockbrings the port back automatically.- Root protection:
no-root-port; superior BPDU leaves the port in a root inconsistent state, and it recovers by itself.
What it is
Spanning tree trusts every BPDU it receives. That trust is a risk on access ports and on links to other parties. Three Junos features protect the tree.
- BPDU protection shuts down an edge port that receives a BPDU. A host port should never receive one.
- Root protection stops a port from becoming the root port. It keeps a switch you do not control from taking over the root bridge role.
- Loop protection guards a port that expects BPDUs against the loss of those BPDUs, which could otherwise open a loop.
How it works
BPDU protection
An edge port connects to a host and goes to forwarding at once. If someone plugs in a switch, that switch may send BPDUs and even claim to be root. BPDU protection puts the port out of service the moment a BPDU arrives.
user@switch# set protocols rstp interface ge-0/0/5 edge
user@switch# set protocols rstp bpdu-block-on-edge
bpdu-block-on-edge applies to all edge ports of the RSTP instance. A port blocked this way stays down until you re-enable it with clear error bpdu interface ge-0/0/5, or until an automatic recovery time ends if you set one.
user@switch# set protocols layer2-control bpdu-block disable-timeout 120
With this timer, a blocked port returns to service after 120 seconds. If a BPDU keeps arriving, it blocks again.
Root protection
Root protection is for ports that must never lead toward the root bridge, such as ports toward customers or toward switches outside your control. The statement is no-root-port.
user@switch# set protocols rstp interface ge-0/0/10 no-root-port
If a superior BPDU, one that would make the neighbor root, arrives on that port, the switch does not accept it. The port is put into a root inconsistent state and does not forward, but it keeps listening. When the superior BPDUs stop, the port recovers on its own.
Loop protection
Loop protection is for ports that receive BPDUs and should keep receiving them: root ports and alternate ports. If BPDUs stop, perhaps because of a one way link failure or a faulty neighbor, a blocked port would normally move to forwarding as designated. That could create a loop.
user@switch# set protocols rstp interface ge-0/0/23 bpdu-timeout-action block
With loop protection, the port goes to a loop inconsistent state and stays blocked when BPDUs stop. When BPDUs arrive again, the port recovers on its own. The other action, alarm, only logs the event and does not block the port.
Comparing the three
| BPDU protection | Root protection | Loop protection | |
|---|---|---|---|
| Applies to | Edge ports | Designated ports facing outsiders | Root and alternate ports |
| Trigger | Any BPDU received | Superior BPDU received | BPDUs stop arriving |
| Result | Port disabled | Port blocked, root inconsistent | Port blocked, loop inconsistent |
| Recovery | Manual, or disable-timeout | Automatic when superior BPDUs stop | Automatic when BPDUs resume |
| Statement | bpdu-block-on-edge | no-root-port | bpdu-timeout-action block |
Monitoring
user@switch> show spanning-tree interface
user@switch> show spanning-tree bridge
user@switch> show interfaces terse ge-0/0/5
show spanning-tree interface lists the port state, and a protected port that has triggered shows the inconsistent or blocked condition instead of forwarding. show interfaces terse shows whether BPDU protection has taken the port down. The system log records the event, which you read with show log messages.
Combine the features by position. Edge ports get edge with BPDU protection. Ports toward outsiders get no-root-port. Uplinks toward the core get loop protection.
Root protection is not the same as making the switch the root. It only refuses a better root on that port. To pick the root, lower the bridge priority.
Common mistakes
Setting BPDU protection without edge ports. The feature acts on edge ports, so mark host ports as edge first.
Putting no-root-port on an uplink toward the real root. The port then refuses the legitimate root's BPDUs and is blocked.
Waiting for a BPDU blocked port to heal. Without a disable-timeout, the port stays down until you re-enable it.
Confusing loop protection with root protection. Loop protection reacts to missing BPDUs, root protection reacts to better BPDUs.
What to remember for the exam
- BPDU protection: edge ports that receive a BPDU are disabled;
bpdu-block-on-edge. disable-timeoutunderprotocols layer2-control bpdu-blockbrings the port back automatically.- Root protection:
no-root-port; superior BPDU leaves the port in a root inconsistent state, and it recovers by itself. - Loop protection:
bpdu-timeout-action blockon the interface underprotocols rstp; lost BPDUs leave the port in a loop inconsistent state. - BPDU protection is for host ports, root protection for ports facing outsiders, loop protection for ports toward the core.
- A host sending BPDUs on an edge port is the standard exam scenario for BPDU protection.
show spanning-tree interfaceshows the state of a protected port.
Check yourself
A user plugs a small switch into a port configured as an edge port with BPDU protection. What happens?
The port receives a BPDU and is disabled until it is re-enabled or the disable timeout ends.
Which feature stops a customer facing port from ever becoming the root port?
Root protection, configured with
no-root-port.What does loop protection do when a root port stops receiving BPDUs?
It blocks the port in a loop inconsistent state instead of letting it go to forwarding, and the port recovers when BPDUs return.
Topic 1 of 4 in Layer 2 Security
Test yourself on Layer 2 Security
The full Juniper JNCIS-ENT JN0-352 question bank has 846 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.