Spanning Tree Algorithm Advanced Computer Networks 1 Topologies

  • Slides: 26
Download presentation
Spanning Tree Algorithm Advanced Computer Networks 1

Spanning Tree Algorithm Advanced Computer Networks 1

Topologies with Loops n Problems n n n Frames proliferate Learning process unstable Multicast

Topologies with Loops n Problems n n n Frames proliferate Learning process unstable Multicast traffic loops forever A LAN 1 B 2 B 3 LAN 2 2

Topologies with Loops n Solutions n n Require that the topologies be loop-free through

Topologies with Loops n Solutions n n Require that the topologies be loop-free through careful deployment of segments and bridges Design Bridges to detect loops and complain and, perhaps, stop working n n Not a good idea because loops provide redundancy Design into the bridges an algorithm that prunes the topology into a loop-free subset (a spanning tree) n n Blocking of some ports may be required Automatically adapt to the changes in topology 3

Reconfiguration Algorithm n n n Configures an arbitrary topology into a spanning tree Automatic

Reconfiguration Algorithm n n n Configures an arbitrary topology into a spanning tree Automatic reconfiguration in case of topology changes The algorithm should converge for any size LAN; the stability should be achieved within a short, bounded time Active topology should be reproducible and manageable Transparency to end-stations is required Must not use a lot of bandwidth 4

Spanning Tree Algorithm n A distributed Algorithm n n n Elects a single bridge

Spanning Tree Algorithm n A distributed Algorithm n n n Elects a single bridge to be the root bridge Calculates the distance of the shortest path from each bridge to the root bridge (cost) For each LAN segment , elects a “designated” bridge from among the bridges residing on that segment n n The designated bridge for a LAN segment is the one closest to the root bridge And… 5

Spanning Tree Algorithm n For each bridge n n Selects ports to be included

Spanning Tree Algorithm n For each bridge n n Selects ports to be included in spanning tree The ports selected are: n n The root port --- the port that gives the best path from this bridge to the root The designated ports --- ports connected to a segment on which this bridge is designated Ports included in the spanning tree are placed in the forwarding state All other ports are placed in the blocked state 6

Forwarding frames along the spanning tree Forward and Blocked States of Ports n n

Forwarding frames along the spanning tree Forward and Blocked States of Ports n n Data traffic (from various stations) is forwarded to and from the ports selected in the spanning tree Incoming data traffic is always discarded (this is different from filtering frames. Why? ) and is never forwarded on the blocked ports 7

Root Selection: Bridge ID n Each port on the Bridge has a unique LAN

Root Selection: Bridge ID n Each port on the Bridge has a unique LAN address just like any other LAN interface card. Bridge ID is a single bridge-wide identifier that could be: n n A unique 48 -bit address Perhaps the LAN address of one of its ports B n Port Address Root Bridge is the one with lowest Bridge ID 8

Path Length (Cost) n n n Path length is the number of hops from

Path Length (Cost) n n n Path length is the number of hops from a bridge to the root While forming a spanning tree, we are interested in the least cost path to the root Cost can also be specified based on the speed of the link n n Not fair to treat a 10 Mb/s link the same as a 1 Gb/s link A guideline for cost selection is in Table 8. 5 of the latest IEEE 802. 1 D standard 9

Path cost guidelines Source: IEEE 802. 1 D standard 10

Path cost guidelines Source: IEEE 802. 1 D standard 10

Example Topology 1 4 8 5 6 7 10 11 2 0 11

Example Topology 1 4 8 5 6 7 10 11 2 0 11

After algorithm execution 1 4 8 RP DP BP RP RP RP DP DP

After algorithm execution 1 4 8 RP DP BP RP RP RP DP DP RP 6 10 11 RP: Root Port DP: Designated Port BP: Blocked Port DP BP DP RP RP 0 5 7 BP RP DP RP 2 DP DP 12

Configuration Message (BPDU) n Configuration Bridge Protocol Data Unit n n Transmitted by Bridges

Configuration Message (BPDU) n Configuration Bridge Protocol Data Unit n n Transmitted by Bridges to implement the spanning tree algorithm Just like any other data link layer frame 6 octets 2 octets Data Field destination source length DSAP SSAP Configuration Message n Destination Adderss: Special Multicast Address n n n 01 -8 -c 2 -00 -00 -00 Source Address: MAC address of the port DSAP = SSAP = 01000010 13

Configuration BPDU Contents n The Data Field of Config BPDU contains: n Root ID

Configuration BPDU Contents n The Data Field of Config BPDU contains: n Root ID n n Cost to Root n n Cost of the known least cost path to the root Transmitting Bridge ID n n ID of the Bridge known to be root ID of the bridge transmitting this message Representation n <Root. ID>. <Cost. To. Root>. <Transmitting. Bridge. ID> 14

BPDU: Transmission and Processing n When a bridge is first booted up: n n

BPDU: Transmission and Processing n When a bridge is first booted up: n n It assumes it is the root Transmits on each port: n n n <own. ID>. <0>. <own. ID> BPDUs are received on each port For each port, every bridge saves the best BPDU received n Best among the ones received or transmitted on that port 15

Comparing two BPDUs n Given two BPDUs containing configuration messages C 1 and C

Comparing two BPDUs n Given two BPDUs containing configuration messages C 1 and C 2: n n C 1 is better than C 2 if root. ID in C 1 is lower than the root. ID in C 2 In case of a tie above, C 1 is better than C 2 if cost in C 1 is lower than the cost in C 2 In case of a tie above, C 1 is better than C 2 if transmitting bridge ID in C 1 is lower than the transmitting bridge ID in C 2 Can we still get a tie? n Consider a bridge with two ports on same segment!!! 16

Port Identifier Each bridge has an internal numbering of its ports These numbers are

Port Identifier Each bridge has an internal numbering of its ports These numbers are unique only for a bridge 1 0 Bridge 2 3 17

Port Identifier n n Port IDs are useful when root. ID, cost, and transmitting.

Port Identifier n n Port IDs are useful when root. ID, cost, and transmitting. Bridge. ID are the same in two configuration messages In such situations, Port IDs are used as tie-breakers and the BPDU with lower port. ID is better 18

Comparing BPDUs n Message C 1 <Root>. <Cost>. <Tx> (a) (b) (c) <29>. <15>.

Comparing BPDUs n Message C 1 <Root>. <Cost>. <Tx> (a) (b) (c) <29>. <15>. <35>. <80>. <39> <35>. <15>. <80> n Message C 2 <Root>. <Cost>. <Tx> <31>. <12>. <32> <35>. <80>. <40> <35>. <18>. <38> In all cases above, C 1 is “better” than C 2 19

Designated Bridge n n If a bridge receives better BPDU on a port than

Designated Bridge n n If a bridge receives better BPDU on a port than the one it would transmit, it will no longer transmit BPDUs on that port As a result, only one bridge called the “designated bridge” transmits configuration BPDUs on each LAN 20

Root ID and Cost: determining n n Consider B with bridge ID 18 Best

Root ID and Cost: determining n n Consider B with bridge ID 18 Best BPDUs on each of its ports are: <Root. ID>. <Cost>. <Transmitter. ID> n n n n Port 1 2 3 4 <12>. <93>. <51> <12>. <85>. <47> <81>. <0>. <81> <15>. <31>. <27> Root bridge ID is determined as 12 Least cost is determined as 85+1 = 86 Port 2 is regarded as the Root port …cont… 21

Root ID and Cost: determining n At next opportunity, B will transmit n <12>.

Root ID and Cost: determining n At next opportunity, B will transmit n <12>. <86>. <18> n n Better than the best BPDUs on all ports Ports 1, 3, and 4 are designated B considers itself designated for the segments connected to ports 1, 3, and 4 B continues transmitting BPDUs on those segments (through respective ports) 22

Spanning Tree Ports n For each bridge, what ports are “included” in the spanning

Spanning Tree Ports n For each bridge, what ports are “included” in the spanning tree? n Root Port n n Designated Port n n On which best of the best BPDUs is received Connected to segments on which B is designated Ports selected in the spanning tree are placed in the forwarding state n B will forward data packets to and from those ports 23

Ports Blocked n n n Bridge B will block a port if it receives

Ports Blocked n n n Bridge B will block a port if it receives a better BPDU on that port than the one it would transmit (except for the root port) Bridge B will no longer transmit BPDUs on either root port or blocked ports Data packets are not forwarded to and received from the blocked ports 24

Example Port 1 Port 2 81. 0. 81 41. 19. 125 Bridge ID 92

Example Port 1 Port 2 81. 0. 81 41. 19. 125 Bridge ID 92 Port 3 Port 5 Port 4 41. 12. 315 41. 12. 111 41. 13. 90 Root Bridge is selected as 41 Least cost to root is 12+1 = 13 Port 4 is selected as root Now B 92 will transmit a BPDU 41. 13. 92 What does it do with the ports? 25

How the Ports are treated? Remember: B 92 will transmit a BPDU 41. 13.

How the Ports are treated? Remember: B 92 will transmit a BPDU 41. 13. 92 n n n Port Port 1: 2: 3: 4: 5: 41. 13. 92 < 81. 0. 81 DP < 41. 19. 125 DP > 41. 12. 315 BP Root Port > 41. 13. 90 BP 26