1. 程式人生 > >IEEE 802.1D 交換機的擴張樹演算法 (Spanning Tree Algorithm)

IEEE 802.1D 交換機的擴張樹演算法 (Spanning Tree Algorithm)

Introduction

A bridge is a MAC layer (layer 2) device which relays(中繼) frames among physically separated LANs and makes the physical LANs appear as one logical LAN to the end stations.

Functions of a Bridge

  • Basic Functions:
    • Frame Forwarding and Filtering.
    • Address Learning
      .
    • Resolving Possible Loops in the Topology.
  • Additional Functions:
    • Congestion Control (Enough Buffer).
    • Static Filtering (Security).
    • Translation (Multi-Bridge).
    • Routing (Multi-Bridge).
    • Segmentation.

Frames Forwarding and Addresses Learning

7 1 6 6 2 4 單位
Preamble SFD DA SA Type LLC PAD FCS bytes

Spanning Tree Routing

  • Frame Forwarding and Filtering:
    • Use the destination MAC address (DMAC) field in each MAC frame.
    • A bridge maintains a filtering database with entries: [Address, Port, Time].
  • Address Learning:
    • Use the source MAC address (SMAC) field in each MAC frame.
    • If the element is already in the database, the entry is updated and the timer is reset.
    • If the element is not in the database, a new entry is created with its own timer.

在這裡插入圖片描述


Loop Problem and Resolution

  • Loops provide network reliability.
  • But loops make frames duplication(副本).
  • Loops also make wrong address learning.

So we need the Graph Representation of a BLAN(Bridged LANs): Spanning Tree.


Spanning Tree Algorithm

For bridge,Each bridge is assigned a unique identifier (8 octets):

  • Priority part (two octets): programmable.
  • address part (six octets): MAC address.
    And Each port of a bridge has a unique port identifier.

There are some definitions:

  • Root Bridge: The bridge with the lowest value of bridge identifier.
  • Path Cost: For each port, the cost of transmitting a frame onto a LAN.
  • Root Port: For each bridge, the port on the minimum-cost path to the root bridge.
  • Root Path Cost: For each bridge, the cost of the path to the root bridge with minimum cost.
  • Designated(特定) Bridge: For each LAN, the bridge that provides the minimum cost path to the root bridge. The only bridge allowed to forward frames to and from the LAN.
  • Designated Port: The port of the designated bridge that attaches the bridge to the LAN. All internet traffic to and from the LAN pass through the designated port.

Three Steps:

  1. Determine the root bridge.
  2. Determine the root port on all other bridges.
  3. Determine the designated port on each LAN.
    • The port with the minimum root path cost.
    • In the case of two or more bridges with the same root path cost, the highest-priority bridge is selected.
    • If the designated bridge has two or more ports attached to this LAN, then the port with the lowest value of identifier is selected.

在這裡插入圖片描述

Bridge Protocol Data Unit (BPDU)

  • Network Configuration(配置) BPDU
Protocol ID Version ID BPDU Type Flag Root Bridge ID RPC Bridge ID Root Port ID Message Age Time Limit Hello Time Forward Delay 單位
2 1 1 1 8 4 8 2 2 2 2 2 bytes
  • Topology Change BPDU
Protocol ID Version ID BPDU Type 單位
2 1 1 bytes

The spanning tree usually is not a minimum cost spanning tree


Spanning Tree Maintenance(保養)

  • The transmission of the configuration BPDU is triggered(觸發) by root.
  • The root will periodically(定期) (once every Hello time) issue(釋出) a configuration BPDU on all LANs to which it is attached.
  • A bridge that receives a configuration BPDU from its root port passes that information to all LANs for which it believes itself to be the designated bridge.
  • A cascade of configuration BPDUs throughout the spanning tree.
  • If the spanning tree topology has changed, The root will set the Topology Change flag in all configuration messages transmitted for some time.

Bridge Faults

  • The Bridges and LAN which affected will trigger the timeout event individually which means the Designated bridge for LAN was gone.
  • Then Bridges will try to serve as the Designated bridge of LAN by forwarding a configuration BPDU.
  • After several forwarding delays, one bridge will become the new Designated bridge of LAN.
  • The Bridge then sends a Topology Change Notification (TCN) BPDU to root bridge.
  • The root will set the Topology Change flag in all configuration messages transmitted for some time.

LAN Faults

The procedure may be same, but we may finally have two separated (disconnected) spanning trees.


想了解更多關於計算機網路架構與網路安全:計算機網路架構與網路安全專欄