lecture 4.0 spanning tree protocols - uniroma2.it · 802.1d spanning tree protocol standard 802.1d...
TRANSCRIPT
1
Giuseppe Bianchi
Lecture 4.0Lecture 4.0
Spanning Tree ProtocolsSpanning Tree Protocols
Giuseppe Bianchi
MutipleMutiple pathspaths ((loopsloops) ) �������� broadcastbroadcast stormstorm! !
LAN1 LAN2
LAN3
LAN4 LAN5
1
1DUPLICATION!!
2
2
2
2
2
3
3
3
3
3
DUPLICATION!!
DUPLICATION!!
2
Giuseppe Bianchi
…… butbut multiple multiple pathspaths essentialessential
forfor reliabilityreliability!!
Giuseppe Bianchi
Canalina metallica forata
Prese RJ45
Cablaggio orizzontale in rame
Armadio di
pianoPrese RJ45
Stanza Stanza Stanza
StanzaStanzaStanza
Armadio di
piano
Tubo in PVC – Cablaggio verticale in Fibra Ottica
Canalina metallica - Cablaggio verticale di backup in rame
Canalina in PVC �
TypicalTypical buildingbuilding
(collapsed backbone – star center – redundant)
3
Giuseppe Bianchi
MeshMesh network MUST network MUST transformtransform
intointo treetree
LAN1 LAN2
LAN3
LAN4 LAN5
Many possible solutions
Giuseppe Bianchi
LogicalLogical viewview
1 2
54
3
1 2
54
3
LAN = circle
4
Giuseppe Bianchi
802.1D 802.1D SpanningSpanning TreeTree ProtocolProtocol
Standard 802.1D - 1990, 1993, 1998
(STP no more included in 802.1D-2004)
Giuseppe Bianchi
SpanningSpanning treetree keykey conceptsconcepts
�Tree topology
�Root bridge
�Root port
�Designated bridge/port
�Topology creation
�BPDUs and distributed operation
�Reconfiguration
�Port states & timers
5
Giuseppe Bianchi
RootRoot bridgebridge
B1 B2
B3 B4
B5 B6 B7
C
B
A
D
FE
J
G
H I
�Root bridge choice -practical rules:
�Bridge in the “center” of the network�In average, shorter
network paths
�High reliability and high performance bridge�With higher rate ports
(e.g. gigabit)
�Must NOT becomeperformance bottleneck
Example: B4 is better choice than B1…
Giuseppe Bianchi
RootRoot bridge: bridge: electionelection rulerule
� Default rule:
� Root bridge = lowest Bridge Identifier�Bridge Identifier = Bridge MAC address
� Configuration:
� Priority field prior to MAC address�By changing priority field, sysadmin may freely choose the root
among his switches
nn:nn:nn:nn:nn:nn0xN000
Bridge Priority(2 B)
Bridge MAC address(6 B)
default0x800032768
Given by vendorNot modificable
(but vendors are smart ☺ - e.g. Cisco)
6
Giuseppe Bianchi
RootRoot portport
B1 B2
B3 B4
B5 B6 B7
C
B
A
D
FE
J
G
H I
�Port used to sendframes to the root
�Port from which frames are received from root
�Exactly one root port
�Except root bridge
Giuseppe Bianchi
RootRoot portport: : electionelection rulerule /1/1� Root port
� port on the least cost path to the root
� Port cost
� sum of cost of links to reach the root
� Link cost
� function of link speed
LINK COST:
� 1000/link_speed_Mbps� 1993 802.1D specification
� Specific Table� 1998 802.1D specification
7
Giuseppe Bianchi
RootRoot portport: : electionelection rulerule /2/2
� What if equal cost ports?
� Tie-break rule:
1) Root port = towards lowest bridge identifier (includingpriority)
2) If still tie (2+ links to same bridge): root port = towardslowest (remote) port number (including priority)
� By playing with bridge priorities and port priorities, a sysadmin may design his own tree
� Among the minimum cost trees conditioned to the specificchoice for the root bridge
Giuseppe Bianchi
WhyWhy designateddesignated portport??
B1 B2
B3 B4
B5 B6 B7
C
B
A
D
FE
J
G
H I
�Root bridge and root portsgenerate a treeof bridges
�But loops are still there (e.g. LAN D)
8
Giuseppe Bianchi
DesignatedDesignated bridge/bridge/portport
B1 B2
B3 B4
B5 B6 B7
C
B
A
D
FE
J
G
H I
�ONE bridge/ portper LAN
�Port from which frames are received
�All the otherbridge ports on the LAN are blocked
�except root ports
ROOT and DESIGNATED ports ���� FORWARDING state
Other ports ���� BLOCKING state
Giuseppe Bianchi
DesignatedDesignated bridge/bridge/portport: :
electionelection rulerule
�Designated = port for which the
path root cost is lower
�If tie, lowest bridge identifier
�If tie again, lowest port identifier
9
Giuseppe Bianchi
ResultResult: : spanningspanning treetree
B1 B2
B3 B4
B5 B6 B7
C
B
A
D
FE
J
G
H I
B1
B2B4
CB A
DH I
B6 B7
G
B3 B5
F J
E
Giuseppe Bianchi
Domanda esame 13/4/2004Domanda esame 13/4/2004
12-12-12-00-00-20
12-12-12-00-00-10
12-12-12-00-00-50
12-12-12-00-00-70
12-12-12-00-00-30
12-12-12-00-00-F0
12-12-12-00-00-80
12-12-12-00-00-40
12-12-12-00-00-60
12-12-12-00-00-90
10
Giuseppe Bianchi
Soluzione esame 13/4/2004Soluzione esame 13/4/2004
12-12-12-00-00-20
12-12-12-00-00-10
12-12-12-00-00-50
12-12-12-00-00-70
12-12-12-00-00-30
12-12-12-00-00-F0
12-12-12-00-00-80
12-12-12-00-00-40
12-12-12-00-00-60
12-12-12-00-00-90
Giuseppe Bianchi
SpanningSpanning treetree keykey conceptsconcepts
�Tree topology
�Root bridge
�Root port
�Designated bridge/port
�Topology creation
�BPDUs and distributed operation
�Reconfiguration
�Port states & timers
11
Giuseppe Bianchi
BPDUBPDU� Bridge Protocol Data Unit (BPDU)
� Exchanged among bridges
� Multicast address 01-80-c2-00-00-00
� 802.3 encapsulation with SAP=0x42 (Spanning Tree Protocol – STP)
� Two BPDUs�Configuration BPDU
�Topology Change Notification BPDU
� Configuration BPDU - contains
� Root identifier (according to the bridge belief)
� Cumulative path cost from the root to the tx port
� Bridge identifier
� Transmit Port identifier
� … etc …
� Topology Change Notification BPDU: empty
Giuseppe Bianchi
ConfigurationConfiguration BPDU BPDU structurestructure
01-80-c2-00-00-00
(multicast address)Unicast bridge addr len 0x42
Configuration BPDU
Or topology change notifFCS0x42 0x03
0x000x0000
nn:nn:nn:nn:nn:nn
Protocol Identifier
Root Path Cost
Protocol Version Identifier
0xN0 BPDU Type (0x00 = Configuration BPDU; 0x80 = Topology Change Notification BPDU)
flags TC – 0 – 0 – 0 – 0 – 0 – 0 – TCA (TCA= Topology Change ACK; TC = Topology Change)
0xN000xxxxxxxx (4 B)
nn:nn:nn:nn:nn:nn0xN000
Root priority + Root Identifier
Bridge priority + Bridge Identifier
0xP0 pp Port priority + Port Identifier
xxxx (2B)xxxx (2B)xxxx (2B)xxxx (2B)
Message Age
Max Age
Hello Time
Forward DelayTOTAL: 35 bytes payload
12
Giuseppe Bianchi
IEEE 802.3 EthernetDestination: 01:80:c2:00:00:00 (Spanning-tree-(for-bridges)_00)Source: 00:09:7c:4d:37:c1 (Cisco_4d:37:c1)Length: 38Trailer: 0000000000000000
Logical-Link ControlDSAP: Spanning Tree BPDU (0x42)IG Bit: IndividualSSAP: Spanning Tree BPDU (0x42)CR Bit: CommandControl field: U, func = UI (0x03)
000. 00.. = Unnumbered Information.... ..11 = Unnumbered frame
Spanning Tree ProtocolProtocol Identifier: Spanning Tree Protocol (0x0000)Protocol Version Identifier: Spanning Tree (0)BPDU Type: Configuration (0x00)BPDU flags: 0x00
0... .... = Topology Change Acknowledgment: No.... ...0 = Topology Change: No
Root Identifier: 0 / 00:09:12:e8:02:61Root Path Cost: 8Bridge Identifier: 32768 / 00:09:7c:4d:37:c2Port identifier: 0x800dMessage Age: 2Max Age: 20Hello Time: 2Forward Delay: 15
0000 01 80 c2 00 00 00 00 09 7c 4d 37 c1 00 26 42 42 ........|M7..&BB0010 03 00 00 00 00 00 00 00 00 09 12 e8 02 61 00 00 .............a..0020 00 08 80 00 00 09 7c 4d 37 c2 80 0d 02 00 14 00 ......|M7.......0030 02 00 0f 00 00 00 00 00 00 00 00 00 ............
Giuseppe Bianchi
SpanningSpanning treetree creationcreation
elementaryelementary case case (and STP (and STP failurefailure -- courtesycourtesy of of ciscocisco))
12_spt_cisco.swf
13
Giuseppe Bianchi
DetailedDetailed bridge bridge operationoperation /1/1
Bridge # 3333
1
2
3
4
BPDU root: 3333
BPDU root: 3333
BPDU root: 3333
BPDU root: 3333
Upon bootstrap, start sending BDPU claiming to be the root
1 BPDU each “hello time” (default = 2s); At least one “hold time” (fixed to 1s) between subsequent BPDUs
BPDU root path cost = 0 (bridge acts as root bridge, initially)
Giuseppe Bianchi
DetailedDetailed bridge bridge operationoperation /2/2
BPDU root: 3333
Bridge # 3333
1
2
3
4
BPDU root: 3333
BPDU root: 3333
BPDU root: 3333
Incoming BPDU root ID > actual root ID
1. ignore on remaining ports
2. react immediately on reception port
BPDU root: 5555
14
Giuseppe Bianchi
DetailedDetailed bridge bridge operationoperation /3/3
Bridge # 3333
1
2
3
4
Incoming BPDU root ID < actual root ID:
1. elect reception port = Root port
2. no not send BPDU on reception port
3. forward BPDU on remaining ports (outgoing BPDU cost = received BPDU cost + output link cost)
BPDU root: 2222, cost=20
BPDU root: 2222, cost=30
BPDU root: 2222, cost=30
BPDU root: 2222, cost=30Root port
Giuseppe Bianchi
DetailedDetailed bridge bridge operationoperation /4/4
Incoming BPDU with same root ID but lower cost:
1. elect new Root port
2. Forward BPDU (increase cost) on other ports
3. Elect designated ports (obvious for #1 and #3 – since they do not receive BPDUs
(#2 designated as same BPDU cost but Bridge ID 3333 < received 4444)
Bridge # 3333
1
2
3
4
BPDU root: 2222, cost=20, BID=4444BPDU root: 2222, cost=10
Rootport
BPDU root: 2222, cost=20
BPDU root: 2222, cost=20
BPDU root: 2222, cost=20
Designated
Designated
Designated
15
Giuseppe Bianchi
DetailedDetailed bridge bridge operationoperation /4bis/4bis
Bridge # 3333
1
2
3
4
BPDU root=2222, cost=20
BPDU root=2222,cost=10BPDU root=2222, cost=20
BPDU root=2222, cost=20
This is how we end up:
BPDUs received through port 4 are forwarded to all the other ports
Giuseppe Bianchi
DetailedDetailed bridge bridge operationoperation /5/5
Bridge # 3333
1
2
3
4
Incoming BPDU from port 1 with same root: tie on BPDU root cost:
1. Port 1 becomes root port (lower BID)
2. Port 4 goes into BLOCKED STATE (incoming cost=10; outgoing cost=20)
3. Ports 3 and 4 remain designated
BPDU, BID=3333, cost=20
Root port
BPDU, BID=6666,cost=10BPDU, BID=3333, cost=20
BPDU, BID=5555, cost=10
X
16
Giuseppe Bianchi
DetailedDetailed bridge bridge operationoperation /6/6
((conclusionconclusion))
Bridge # 3333
1
2
3
4
Root port = 1
Designated ports = 2, 3
(2 has been designated by comparison with incoming BPDU: will not receive BPDUs (peer port blocked)
(3 has never received BPDU ���� designated by default)
Blocked = 4 (a blocked port does NOT send BPDUs but will continue receiving BPDUs!!)
BPDU root: 2222, cost=20
BPDU root: 2222, cost=10
Root port
BPDU root: 2222, cost=20
BPDU root: 2222, cost=10
X
Giuseppe Bianchi
SpanningSpanning treetree keykey conceptsconcepts
�Tree topology
�Root bridge
�Root port
�Designated bridge/port
�Topology creation
�BPDUs and distributed operation
�Reconfiguration
�Port states & timers
17
Giuseppe Bianchi
PortPort statesstates
� Two possibilities in stabilized topology operation:
� Blocked port
� Forwarding port�Root port or designated port
� Upon riconfiguration, two additional transient states:
� Listening
� Learning
� Finally, a port can be disabled
Giuseppe Bianchi
WhyWhy slow slow BB��������FF transitiontransition neededneeded??
�Too fast topologyvariations mightcreate
�duplicated packets
�misordered delivery
�(both forbidden byIEEE specs)!
A B
X
B not in
forwarding DB
BLOCK
18
Giuseppe Bianchi
WhyWhy slow slow BB��������FF transitiontransition neededneeded??
�Too fast topologyvariations mightcreate
�duplicated packets
�misordered delivery
�(both forbidden byIEEE specs)!
A BFast reconfig
���� duplicate!
FWD
Giuseppe Bianchi
PortPort statesstates
� Blocking
� Port discards incoming frames and do not transmit frames
� Receives BPDUs but does not forward them
� Transition to listening state when no BPDU arrive by max-age expiration
� Listening
� Port discards incoming frames and do not transmit frames
� Receives BPDUs and forwards them
� Transition to learning state after a forward delay time
� Learning
� Discard frames, but learns and prepares forwarding DB
� Transition to forwarding state after a forward delay time
� Forwarding
� Port (root or designated) activated
Blocking ���� forwarding = max-age + 2 x Forward_delay
19
Giuseppe Bianchi
PortPort state state transitionstransitions
Giuseppe Bianchi
ExampleExample: : addingadding a a linklink /1/1
1 2
3
45
76
A new link between
B1 and B5 is activated.
Corresponding ports
go into listening state
(= get involved in BPDU
exchange)
20
Giuseppe Bianchi
ExampleExample: : addingadding a a linklink /2/2
1 2
3
45
76
Listening
stateB5 in listening state
Receives BDPU.
Sets new root port #1
(previous root port = #2)#1
#2
Giuseppe Bianchi
ExampleExample: : addingadding a a linklink /3/3
1 2
3
45
76
Listening
stateB5 forwards
the BPDU on its
designated ports
21
Giuseppe Bianchi
ExampleExample: : addingadding a a linklink /4/4
1 2
3
45
76
Listening
stateB3 and B4 receive mutual
BPDUs
Tie situation: B3 designated
B4 BLOCKS port!
Giuseppe Bianchi
ExampleExample: : addingadding a a linklink /5/5
1 2
3
45
76
Listening
stateNew topology found!
Unfortunately network
will remain cut until
port of B1 on link 1-5
will enter forwarding
state (2 x forward delay)
Not a problem if timers were short, but…
22
Giuseppe Bianchi
TimersTimers
In seconds
Coded in the BPDU in 1/256 of a second
Convenient hex notation: 0x0400 = 4 seconds
Why so long?
Fwd delay must account for
1) Propagation of BPDUs along the whole
network diameter (each bridge introduces
as much as 1s delay)
2) Lifetime in the network of a frame forwarded
by previous active topology
Approx 2 x maximum network crossing-time
Giuseppe Bianchi
TopologyTopology changechange: : whywhy??
23
Giuseppe Bianchi
TopologyTopology changechange: : whywhy??
Giuseppe Bianchi
TopologyTopology ChangeChange NotificationNotification
BPDUBPDU
� To notify upstreams a detected change of topology
� Port switched to forwarding state
� Port switched to blocking state (from listening of learning states)
� Forwarded upstreams by intermediate bridges, up to the Root
� No parameters carried by the TCN BPDU
� Just 4 bytes
� Acknowledged by designated bridge via TCA flag
� And so on until root
� Root transmits TC in subsequent BPDU
0x000x0000 Protocol Identifier
Protocol Version Identifier
0x80 0x80 = Topology Change Notification BPDU)
24
Giuseppe Bianchi
TCA managementTCA management
Giuseppe Bianchi
TopologyTopology changechange flagflag
root
bridge
TCN TCA TC
Topology Change Time = max-age + 2 forward-delay
Extremely important!!!!
Tells the switches to USE forward delay as age of the forwarding database entries
instead of ageing time
Allows fast clean of obsolete entries
25
Giuseppe Bianchi
TopologyTopology changechange operationoperation
2
Giuseppe Bianchi
RapidRapid SpanningSpanning TreeTree ProtocolProtocol
RSTPRSTP
Standard 802.1w–2001
Now included in standard 802.1D-2004, clause 17
26
Giuseppe Bianchi
RSTPRSTP
� Design goal
� Drop reconfiguration time from o(50 seconds) to o(few ms)
� Major enhancements
� Rely on hardware techniques to detect link/port failure
� Brand new BPDU handling during reconfiguration
� New Port roles, port states and state transitions�Faster transition (up to order of ms)
�Entries explicitly removed from forwarding DB
� STP compliant
� If STP BPDU detected, rolls back to STP operation
� Conformance to 802 standard
� From 2004, RSTP has become THE spanning tree standard�A 2004+ switch MUST support RSTP
� STP will be abandoned in time
Giuseppe Bianchi
PortPort statesstates & & rolesroles((unclearunclear separationseparation betweenbetween state and state and rolerole in 802.1D)in 802.1D)
YesYesForwardingForwarding
YesYesLearningLearning
NoYesDiscardingListening
NoNoDiscardingBlocking
NoNoDiscardingDisabled
Is Port Learning
MAC Addresses?
Is Port Included in
Active Topology?
RSTP
(802.1w) Port State
STP
(802.1D) Port State
Backup PortReplace BLOCKED portAlternate Port
Same as STPDesignated Port
Same as STPRoot Port
commentRSTP (802.1w)
Port Role
Port notation:
Role State
(e.g.
-root forwarding
-Designated discarding
27
Giuseppe Bianchi
New New PortPort rolesroles
Alternate path available in the network
Redundant connectivity to the same LAN
Giuseppe Bianchi
EdgeEdge portsports
Edge ports – unlike 802.1D, their failure does not trigger RSTP!
Edge port is external to STP operation (cannot create loops)
Hence can be immediately set to forwarding state
Concept NOT available in 802.1D (but vendors had included it in their products – e.g. Cisco portfast
28
Giuseppe Bianchi
New BPDU handlingNew BPDU handling
�STP:
�Generated by root
�Forwarded by bridge
�RSTP
�Generated by bridge» Not necessarily in response to a
BPDU received on root port
�Contain specific information on tx port» 6 flags added
�Usage:
�Lack of reception of 3 consecutive BPDU = assume connectivity lost
» BPDUs = keep-alive messages among adjacent bridges!
Giuseppe Bianchi
ExampleExample: : addingadding a a linklink /1/1
1 2
3
45
76
29
Giuseppe Bianchi
ExampleExample: : addingadding a a linklink /2/2
1 2
3
45
76
No more listening state
Ports placed in designated discarding state
BPDU exchanged with
“proposal bit” set
B5 realizes new root path:SYNC operation!1. Blocks all his ports!
2. Sends to B1 BPDU with agreement flag
3. B1 will transition to forwarding!
IDEA: close all possible paths (loops)
before telling B1 to activate port
Designated
discarding
state
Giuseppe Bianchi
ExampleExample: : addingadding a a linklink /3/3
1 2
3
45
76
SYNC procedure
propagates (fast convergence)
…
B4 port on 3-4 link will
be blocked, as before
30
Giuseppe Bianchi
TopologyTopology ChangesChanges / 1/ 1
1 2
3 4
5 6
7
Initial state
And failure
Giuseppe Bianchi
TopologyTopology ChangesChanges / 2/ 2
1 2
3 4
5 6
7
B5 and B7 flush
entries associated to
failed ports
B7 selects alternate port
B7 sends TCN
31
Giuseppe Bianchi
TopologyTopology ChangesChanges / 3/ 3
1 2
3 4
5 6
7
B6 flush entries
(but keeps entries
for downstream port)
B6 sends TCN on
port towards B3
Giuseppe Bianchi
TopologyTopology ChangesChanges / 4/ 4
1 2
3 4
5 6
7
B3 flush entries
(but keeps entries
for downstream port)
B3 sends TCN on
both ports!!