Top Banner
Ming Liu mgliu@cs.wisc.edu Introduction to Computer Networks CS640 https://pages.cs.wisc.edu/~mgliu/CS640/F21/ L2 Switching 1
46

Introduction to Computer Networks CS640 L2 Switching

Apr 06, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to Computer Networks CS640 L2 Switching

Ming Liu [email protected]

Introduction to Computer Networks

CS640 https://pages.cs.wisc.edu/~mgliu/CS640/F21/

L2 Switching

1

Page 2: Introduction to Computer Networks CS640 L2 Switching

Today

Last lecture • Wireless network

2

Today • L2 switching

Announcements • Lab1 due today at 11:59PM

Page 3: Introduction to Computer Networks CS640 L2 Switching

Local Area Network (LAN)

Direct

Shared

Limitation • Cannot scale

• Limit on the number of hosts • Distance

• Broadcast-based: limits bandwidth since each

communication stream consumes the bandwidth

of the entire network • Rely on a single administrative control

LAN refers to an Ethernet shared link or an access point and all hosts associated with it

3

Page 4: Introduction to Computer Networks CS640 L2 Switching

Building Large LANs: Switches (Bridges)

End Point

Link

Switch

4

Page 5: Introduction to Computer Networks CS640 L2 Switching

Building Large LANs: Switches (Bridges)

Link layer devices that have multiple input/output ports (interfaces) where LANs/hosts/other switches can plug in • Packets arrive on a port • A table lookup occurs • Based on the outcome, packets are forwarded to a port

4

Page 6: Introduction to Computer Networks CS640 L2 Switching

Building Large LANs: Switches (Bridges)

At layer 2, switches(bridges) connect multiple LANs • Separate a single LAN into multiple smaller collision domains • Reduce collision domain size

4

Page 7: Introduction to Computer Networks CS640 L2 Switching

Building Large LANs: Switches (Bridges)

At layer 2, switches(bridges) connect multiple LANs • Separate a single LAN into multiple smaller collision domains • Reduce collision domain size

Recap: hubs are physical level devices • Don’t isolate collision domains due to broadcast

4

Page 8: Introduction to Computer Networks CS640 L2 Switching

Building Large LANs: Switches (Bridges)

Bus topology —> Star topology • Form the basis for scalable connectivity as nodes can be added without impacting

efficiency

Direct

Shared

4

Page 9: Introduction to Computer Networks CS640 L2 Switching

Basic Switch (Bridge) Functionality

Frame comes in on an interface • Switch looks at the destination LAN address • Performs a table lookup to determine port on which hosts are connected

• Only forward packets to the right port • Must run CSMA/CD with hosts connected to the same LAN

Preamble8B

Dest Source Type Data CRCPad6B 6B 2B 4B

5

Page 10: Introduction to Computer Networks CS640 L2 Switching

Design features: • “Plug and play” capability • Self-configuring without hardware or software changes • Bridge do not impact the operation of the individual LANs

“Transparent” Switches (Bridges)

6

Page 11: Introduction to Computer Networks CS640 L2 Switching

“Transparent” Switches (Bridges)

Design features: • “Plug and play” capability • Self-configuring without hardware or software changes • Bridge do not impact the operation of the individual LANs

Three major functionalities: • Forwarding of frames • Learning of addresses • Spanning tree algorithm

6

Page 12: Introduction to Computer Networks CS640 L2 Switching

Frame Forwarding

Each switch maintains a forwarding database: • <MAC address, port, age>

• MAC address: the destination host or group address • Port: port number of the switch

• Age: age of the entry

MAC address Port Age (s)

11:22:33:44:55:66 1 2

77:88:99:aa:bb:cc 2 4

dd:ee:ff:11:22:33 3 6

7

Page 13: Introduction to Computer Networks CS640 L2 Switching

Frame Forwarding (cont’d)

For every frame, the switch “looks up” the entry for the packet’s destination MAC address and forwards the packet on that port • No entry -> packets are broadcast

The size of the forwarding table in worst case is the number of nodes

8

Page 14: Introduction to Computer Networks CS640 L2 Switching

Address Lookup Example

Address is a 48 bit IEEE MAC address Flat address -> no aggregation

MAC address Port Age (s)

11:22:33:44:55:66 1 2

77:88:99:aa:bb:cc 2 4

dd:ee:ff:11:22:33 3 6

Host1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

Host2 (dd:ee:ff:11:22:33)

9

Page 15: Introduction to Computer Networks CS640 L2 Switching

Host2 (dd:ee:ff:11:22:33)

Address Lookup Example

Address is a 48 bit IEEE MAC address Flat address -> no aggregation

MAC address Port Age (s)

11:22:33:44:55:66 1 2

77:88:99:aa:bb:cc 2 4

dd:ee:ff:11:22:33 3 6

What is the lookup algorithm?

Host1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

9

Page 16: Introduction to Computer Networks CS640 L2 Switching

Host2 (dd:ee:ff:11:22:33)

Address Lookup Example

Address is a 48 bit IEEE MAC address Flat address -> no aggregation

MAC address Port Age (s)

11:22:33:44:55:66 1 2

77:88:99:aa:bb:cc 2 4

dd:ee:ff:11:22:33 3 6

What is the lookup algorithm? • Cheap switch: a hash table

• High-end switch: content addressable memory

Host1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

9

Page 17: Introduction to Computer Networks CS640 L2 Switching

Host2 (dd:ee:ff:11:22:33)

Address Lookup Example

Address is a 48 bit IEEE MAC address Flat address -> no aggregation

MAC address Port Age (s)

11:22:33:44:55:66 1 2

77:88:99:aa:bb:cc 2 4

dd:ee:ff:11:22:33 3 6

What is the lookup algorithm? • Cheap switch: a hash table

• High-end switch: content addressable memory

How to build the table?

Host1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

9

Page 18: Introduction to Computer Networks CS640 L2 Switching

Switch MAC Learning

An alternative approach: manual configuration • Time consuming, error-prone

• Self-configured preferred

Key idea: keep track of source address of packet (S) and the arriving interface (I) • Fill in the forwarding table based on this information

• Frames with destination address S must be sent to interface I

10

Page 19: Introduction to Computer Networks CS640 L2 Switching

MAC Learning ExampleHost1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

Host2 (dd:ee:ff:11:22:33)

MAC address Port Age (s)Host1 -> Host 3

11

Page 20: Introduction to Computer Networks CS640 L2 Switching

MAC Learning ExampleHost1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

Host2 (dd:ee:ff:11:22:33)

MAC address Port Age (s)

11:22:33:44:55:66 1 10

Host1 -> Host 3 • Frames come to port 1 and then broadcast • 10s is the default aging value

11

Page 21: Introduction to Computer Networks CS640 L2 Switching

MAC Learning ExampleHost1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

Host2 (dd:ee:ff:11:22:33)

MAC address Port Age (s)

11:22:33:44:55:66 1 8

77:88:99:aa:bb:cc 2 10

Host1 -> Host3 • Frames come to port 1 and then broadcast • 10s is the default aging value

Host2 -> Host3 • Frames come to port 2 and then broadcast

11

Page 22: Introduction to Computer Networks CS640 L2 Switching

MAC Learning ExampleHost1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

Host2 (dd:ee:ff:11:22:33)

MAC address Port Age (s)

11:22:33:44:55:66 1 6

77:88:99:aa:bb:cc 2 8

dd:ee:ff:11:22:33 3 10

Host1 -> Host3 • Frames come to port 1 and then broadcast • 10s is the default aging value

Host2 -> Host3 • Frames come to port 2 and then broadcast

Host3 -> Host1 • Frames come to port 3 and then ?

11

Page 23: Introduction to Computer Networks CS640 L2 Switching

MAC Learning ExampleHost1 (11:22:33:44:55:66) Host3 (77:88:99:aa:bb:cc)

Host2 (dd:ee:ff:11:22:33)

MAC address Port Age (s)

11:22:33:44:55:66 1 6

77:88:99:aa:bb:cc 2 8

dd:ee:ff:11:22:33 3 10

Host1 -> Host3 • Frames come to port 1 and then broadcast • 10s is the default aging value

Host2 -> Host3 • Frames come to port 2 and then broadcast

Host3 -> Host1 • Frames come to port 3 and then forward

11

Page 24: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm

More complex topologies can provide redundancy • But can also create loops • E.g., What happens when there is no table entry?

• Multiple copies of data

• Could crash the network —> has happened often!

12

Page 25: Introduction to Computer Networks CS640 L2 Switching

What is a Spanning Tree?

Reduce our topology graph to a tree: • Make sure there are no loops in the topology • All LAN segments are still connected to the LAN and can receive messages

Main idea: Switches (Bridges) choose the ports over which they have to forward frames

13

Page 26: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Protocol Overview

Embed a tree that provides a single unique default path to each destination

Switches(Bridges) designate ports over which they will or will not forward frames

By removing ports, extended LAN is reduced to a tree

14

Page 27: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Protocol Overview

Embed a tree that provides a single unique default path to each destination

Switches(Bridges) designate ports over which they will or will not forward frames

By removing ports, extended LAN is reduced to a tree

Address the crashing problem; but tree is resilient

When switch/links failed, rerun protocol to convert to a new tree

14

Page 28: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm

15

Page 29: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm

#1: Root of the spanning tree is elected first —> the bridge with the lowest identifier • All ports are part of the tree

#2: Each switch (bridge) finds the shortest path to the root • Remembers port that is on the shortest path

• Used to forward packets

15

Page 30: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm (cont’d)

#3: Select for each LAN a designated switch that will forward frames to the root • Has the shorts path to the root • Identifier as tie-breaker

15

Page 31: Introduction to Computer Networks CS640 L2 Switching

Algorithm Details

Each node sends configuration messages to all neighbors • Identifier of the sender • Id of the presumed root • Distance to the presumed root

16

Page 32: Introduction to Computer Networks CS640 L2 Switching

Algorithm Details

Each node sends configuration messages to all neighbors • Identifier of the sender • Id of the presumed root • Distance to the presumed root

Initially each bridge thinks it is the root • S5 sends (S5, S5, 0)

• S3 sends (S3, S3, 0)

16

Page 33: Introduction to Computer Networks CS640 L2 Switching

When S receives a configuration message, it decides whether the solution is better than their location solution • A root with a lower identifier?

• Same root but lower distance?

• Same root, distance but sender has lower identifier?

Algorithm Details (cont’d)

17

Page 34: Introduction to Computer Networks CS640 L2 Switching

If S receives messages from a switch with smaller root ID • S is not root • S should stop generative configuration message, but continues to forward (with +1 distance)

Algorithm Details (cont’d)

17

Page 35: Introduction to Computer Networks CS640 L2 Switching

If S receives message from a switch closer to root • S is not the designated switch

• S should stop sending any configuration messages on

the port • Block port

Algorithm Details (cont’d)

17

Page 36: Introduction to Computer Networks CS640 L2 Switching

Each switch S can now select which of its ports make up the spanning tree

States for ports on switches • Forward state or blocked state, depending on whether the port is part of the spanning

tree

Stable Execution States

Root periodically sends configuration messages and switches forward them over their responsible LANs

18

Page 37: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm Example

#1: Node S2 • Sends (S2, S2, 0)

• Receives (S1, S1, 0) from S1

• Sends (S2, S1, 1) “up”

• Continues the forwarding forever

19

Page 38: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm Example

#1: Node S2 • Sends (S2, S2, 0)

• Receives (S1, S1, 0) from S1

• Sends (S2, S1, 1) “up”

• Continues the forwarding forever

#2: Node S1 • Will send notification forever

19

Page 39: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm Example (cont’d)

#3: Node S7 • Sends (S7, S7, 0)

• Receives (S1, S1, 0) from S1

• Sends (S7, S1, 1) “up” and “right”

20

Page 40: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm Example (cont’d)

#3: Node S7 • Sends (S7, S7, 0)

• Receives (S1, S1, 0) from S1

• Sends (S7, S1, 1) “up” and “right” • Receives (S5, S5, 0) — ignored

• Receives (S5, S1, 1) — suboptimal • Continues forwarding the S1 message forever to the

“right”

20

Page 41: Introduction to Computer Networks CS640 L2 Switching

Spanning Tree Algorithm Example (cont’d)

#4: Node S3 • Sends (S3, S3, 0)

• Receives (S2, S2, 0) from S1

• Since 2<3, S3 accepts S2 as root • S3 adds one to the distance advertised by S2 (0), so it sends (S3, S2, 1) toward S5

• Meanwhile S2 accepts as the root and sends (S2, S1, 1)

• S5 accepts S1 as the root and sends (S5, S1, 1) which

eventually reaches S3

• S3 accepts S1 as the root and figures that S5 and S2

are closer to the root. So stops forwarding on (i.e., blocks) both interfaces 21

Page 42: Introduction to Computer Networks CS640 L2 Switching

Store-and-Forward v.s. Cut-Through

A switch perform store-and-forward will wait to forward a frame until it receives the entire frame

Switches can use different forwarding techniques

DstSrcTypeData

Switch

22

Page 43: Introduction to Computer Networks CS640 L2 Switching

Store-and-Forward v.s. Cut-Through

A switch perform store-and-forward will wait to forward a frame until it receives the entire frame

Switches can use different forwarding techniques

DstSrcTypeData

Switch

22

Page 44: Introduction to Computer Networks CS640 L2 Switching

Store-and-Forward v.s. Cut-Through (cont’d)

Switches can use different forwarding techniques

A cut-through switch will forward the data before it has completed receiving the frame

DstSrcTypeData

Switch

23

Page 45: Introduction to Computer Networks CS640 L2 Switching

Store-and-Forward v.s. Cut-Through (cont’d)

Switches can use different forwarding techniques

A cut-through switch will forward the data before it has completed receiving the frame

DstSrcTypeData

Switch

23

Page 46: Introduction to Computer Networks CS640 L2 Switching

Summary

Today • L2 switching

Next lecture • Internet Protocols

24