10 Switches
10 Switches
1
Goals
• Devices that shuttle data at different layers
– Repeaters and hubs
– Bridges and switches
– Routers
HTTP message
HTTP HTTP
TCP segment
TCP TCP
router router
4
Shuttling Data at Different Layers
• Different devices switch different things
– Network layer: packets (routers)
– Link layer: frames (bridges and switches)
– Physical layer: electrical signals (repeaters and hubs)
Application gateway
Transport gateway
Frame Packet TCP User
Router header header header data
Bridge, switch
Repeater, hub
5
Physical Layer: Repeaters
• Distance limitation in local-area networks
– Electrical signal becomes weaker as it travels
– Imposes a limit on the length of a LAN
Repeater
6
Physical Layer: Hubs
• Joins multiple input lines electrically
– Designed to hold multiple line cards
– Do not necessarily amplify the signal
hub
hu hub
b
7
Limitations of Repeaters and Hubs
• One large shared link
– Each bit is sent everywhere
– So, aggregate throughput is limited
– E.g., three departments each get 10 Mbps independently
– … and then connect via a hub and must share 10 Mbps
Bridge
A C
switch
D 10
Dedicated Access and Full Duplex
• Dedicated access
– Host has direct connection to the switch
– … rather than a shared LAN connection
• Full duplex
– Each connection can send in both directions
– Host sending to switch, and host receiving from switch
– E.g., in 10BaseT (10 mbps) (connect with RJ 45) and
100Base T (100 mbps) used for fast Ethernet.
11
Bridges/Switches: Traffic Isolation
• Switch breaks subnet into LAN segments
• Switch filters packets
– Frame only forwarded to the necessary segments
– Segments can support separate transmissions
switch/bridge
segment
hub
hub hub
segment segment 12
Advantages Over Hubs/Repeaters
• Only forwards frames as needed
– Filters frames to avoid unnecessary load on segments
– Sends frames only to segments that need to see them
13
Disadvantages Over Hubs/Repeaters
• Delay in forwarding frames
– Bridge/switch must receive and parse the frame
– … and perform a look-up to decide where to forward
– Storing and forwarding the packet introduces delay
– Solution: cut-through switching (forward as soon as
possible when received)
• Higher cost
– More complicated devices that cost more money 14
Motivation For Cut-Through Switching
• Buffering a frame takes time
– Suppose L is the length of the frame
– And R is the transmission rate of the links
– Then, receiving the frame takes L/R time units
A B
switches
15
Cut-Through Switching
• Start transmitting as soon as possible
– Inspect the frame header and do the look-up
– If outgoing link is idle, start forwarding the frame
• Overlapping transmissions
– Transmit the head of the packet via the outgoing link
– … while still receiving the tail via the incoming link
– Analogy: different folks crossing different intersections
A B
switches
16
Motivation For Self Learning
• Switches forward frames selectively
– Forward frames only on segments that need them
• Switch table
– Maps destination MAC address to outgoing interface
– Goal: construct the switch table automatically
A C
switch
D 17
Self Learning: Building the Table
• When a frame arrives
– Inspect the source MAC address
– Associate the address with the incoming interface
– Store the mapping in the switch table
– Use a time-to-live field to eventually forget the mapping
Switch learns B
how to reach A.
A C
D 18
Self Learning: Handling Misses
• When frame arrives with unfamiliar destination
– Forward the frame out all of the interfaces
– … except for the one where the frame arrived
– Hopefully, this case won’t happen very often
When in B
doubt,
shout!
A C
D 19
Switch Filtering/Forwarding
When switch receives a frame:
21
Solution: Spanning Trees
• Ensure the topology has no loops
– Avoid using some of the links when flooding
– … to avoid forming a loop
• Spanning tree
– Sub-graph that covers all vertices but contains no cycles
– Links not in the spanning tree do not forward frames
22
Constructing a Spanning Tree
• Need a distributed algorithm
– Switches cooperate to build the spanning tree
– … and adapt automatically when failures occur
• More recently…
– Hubs and switches changed all that
– Every office connected to central wiring closets
– Often multiple LANs (k hubs) connected by switches
– Flexibility in mapping offices to different LANs
• Load
– Some LAN segments are more heavily used than others
– E.g., researchers running experiments get out of hand
– … can saturate their own segment and not the others
– Plus, there may be natural locality of communication
– E.g., traffic between people in the same research group
29
People Move, and Roles Change
• Organizational changes are frequent
– E.g., faculty office becomes a grad-student office
– E.g., graduate student becomes a faculty member
30
Example: Two Virtual LANs
RO RO
R RO O
R O O O R O R R
R RO O
R O
R O
34
Comparing Hubs, Switches, Routers
35
Conclusion
• Shuttling data from one link to another
– Bits, frames, packets, …
– Repeaters/hubs, bridges/switches, routers, …
• Next week
– Monday: Links
– Wednesday: Midterm exam
36