0% found this document useful (0 votes)
21 views36 pages

Lec04 Routers

Uploaded by

sewakassie16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views36 pages

Lec04 Routers

Uploaded by

sewakassie16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

COS 461 Computer Networks

Lecture 4: Hubs, Switches, and


Routers

Kyle Jamieson
Fall 2020
Today: Hubs, Switches, and
Routers, Oh My!
host host
HTTP message
HTTP HTTP Application

TCP segment
TCP TCP Transport
router router
IP packet IP packet IP packet
IP IP IP IP Network

Ethernet
interface
Ethernet
interface
SONET
interface
SONET
interface
Ethernet
interface
Ethernet
interface Link

2
Terminology
• Hubs and Repeaters
– Connect machines on same “layer 2” LAN
– Broadcast: All frames are sent out all physical ports

• Switches and Bridges


– Connect machines on same “layer 2” LAN
– Only send frames to selected physical port based on
destination MAC address

• Routers
– Connect between LANs at “layer 3”, e.g., wide area
– Only send packet to selected physical port based on
destination IP address 3
“Layer 2”
Hubs and Switches

4
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
• Repeaters join LANs together
– Analog electronic device
– Continuously monitors electrical signals
– Transmits an amplified copy

Repeater
5
Physical Layer: Hubs
• Joins multiple input lines electrically
– Designed to hold multiple line cards
– Do not necessarily amplify the signal
• Very similar to repeaters
– Also operates at the physical layer
hub

hub
hub hub

6
Limitations of Repeaters and Hubs
• One large shared link
– Each bit is sent everywhere
– So, aggregate throughput is limited

• Cannot support multiple LAN technologies


– Does not buffer or interpret frames
– Can’t interconnect between different rates/formats

• Limitations on maximum nodes and distances


– Shared medium imposes length limits
– E.g., cannot go beyond 2500 meters on Ethernet

7
Link Layer: Bridges
• Connects two or more LANs at the link layer
– Extracts destination address from the frame
– Looks up the destination in a table
– Forwards the frame to the appropriate segment
• Each segment can carry its own traffic
host host host host host host

Bridge

host host host host host host


8
Link Layer: Switches
• Typically connects individual computers
– A switch is essentially the same as a bridge
– … though typically used to connect hosts
• Supports concurrent communication
– Host A can talk to C, while B talks to D
B

A C

switch

D
9
Bridges/Switches: Traffic Isolation
• Switch filters packets
– Frame only forwarded to the necessary segments
– Segments can support separate transmissions
switch/bridge

segment

hub
hub hub

segment segment

10
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 timer to eventually forget the mapping
B

A C

Switch learns how


to reach A
D
11
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
doubt, A C
shout!

D
12
Switches vs. Hubs
• Compared to hubs, Ethernet switches support
(Y) Larger geographic span
(M) Similar span
(C) Smaller span

• Compared to hubs, switches provide


(Y) Higher load on links
(M) Less privacy
(C) Traffic isolation

13
Routers: Looking closer…

14
Basic Router Architecture
• Each switch/router has a forwarding table
– Maps destination address to outgoing interface

• Basic operation
1. Receive packet
2. Look at header to determine destination address
3. Look in forwarding table to determine output interface
4. Modify packet header (e.g., decr TTL, update chksum)
5. Send packet to output interface
15
Basic Router Architecture
Data Hdr
Lookup Update
Queue
Address Header
Addr Next Hop

Address
Table

Line Card (I/O)


• Basic operation
1. Receive packet
2. Look at header to determine destination address
3. Look in forwarding table to determine output interface
4. Modify packet header (e.g., decr TTL, update chksum)
5. Send packet to output interface
16
Router

control plane
data plane Processor

Line Card Line Card

Switching
Line Card Line Card
Fabric

Line Card Line Card

17
Router

data plane Processor

Line Card 1. Placement, behavior


of lookup tables
Switching
Line Card 2. Design of switching
Fabric
fabric
Line Card

18
Lookup algorithm depends on protocol

Protocol Mechanism Techniques

• Direct lookup
Ethernet (48 bits)
• Associative lookup
MPLS Exact Match
• Hashing
ATM
• Binary tree

• Radix trie
IPv4 (32 bits)
Longest-Prefix Match • Compressed trie
IPv6 (128 bits)
• TCAM

19
Longest Prefix Match (LPM)
• Each packet has destination IP address
• Router looks up table entry that matches address

Prefix Output
68.208.0.0/12 1
68.211.0.0/17 1
68.211.6.120
68.211.128.0/19 2
68.211.160.0/19 2
68.211.192.0/18 1

20
LPM: Motivation
• Each packet has destination IP address
• Router looks up table entry that matches address

• Benefits of CIDR allocation and LPM


– Efficiency: Prefixes can be allocated at much finer
granularity

– Hierarchical aggregation: Upstream ISP can aggregate


2 contiguous prefixes from downstream ISPs to
shorter prefix

21
Software LPM lookup using trie
• Prefixes “spelled out” by following path from root
• To find the best prefix spell out address in trie

1
Prefixes

A 111* 0 1
B 10* B
1 1
C 1010*
A
0
D 10101
C 1
D 22
Software LPM lookup using trie
• Prefixes “spelled out” by following path from root
• To find the best prefix spell out address in trie

1
• 1 lookup per level à max 32
lookups/address! 0 1
• Too slow: B
– E.g., “Optical Carrier 48” line 1 1
(2.5 Gbps) requires 160ns A
lookup … or 4 memory 0
accesses C 1
D 23
Software LPM lookup: k-ary trie (k=2)
Prefixes

A 111*

B 10*
10 11
C 1010* B
10 10 11
D 10101
C A A
10 11

D D

24
Hardware for LPM lookup
• Content-Address Memory (CAM)
– Input: tag (address)
– Output: value (port
– Exact match, but O(1) in hardware
• Ternary CAM
– Can have wildcards: 0, 1, *
– “value” memory cell and “mask” (care / don’t care) cell
• LPM via TCAM
– In parallel, search all prefixes for all matches
– Then choose longest match
• Trick: choose first match, but already sorted by prefix length

25
Example: LPM with a TCAM

Prefix TCAM format


101/3 101X
111/3 111X
10/2 10XX
0/0 XXXX
26
[thenetworksherpa.com/tcam-in-the-forwarding-engine]
Decision: Forwarding table per line card

data plane Processor

Line Card 1. Each line card has


own forwarding
Switching table copy
Line Card
Fabric 2. Prevents central
table bottleneck
Line Card (vs. early routers
had table across
shared bus) 27
Decision: Crossbar switch

control plane
data plane Processor

Line Card Line Card

Line Card ???? Line Card

Line Card Line Card

28
Decision: Crossbar switch
• Shared bus
– Only one input can speak to one output at a time

• Crossbar switch / switched backplane


– Input / output pairs that don’t compete can send
in same timeslot

29
Crossbar switching
• Every input port has connection to every output port
• In each timeslot, each input connected to zero or
more outputs

1 4

2 5

3 6

30
Crossbar switching
• Every input port has connection to every output port
• In each timeslot, each input connected to zero or
more outputs

1
2
• Good parallelism
3
• Needs scheduling

4 5 6
31
Everything gets complicated…
• Problem: Head-of-line blocking
– The packet in front of queue blocks packets behind it from
being processed
– Say first packet at input 1 wants to go to output 5;
second packet at 1 that wants 4 is still blocked

1 4

2 5

3 6
32
Everything gets complicated…
• Solution: Virtual output queues
– One queue at input, per output port (for all inputs)
– So avoids head-of-line blocking during crossbar
scheduling

1 4

2 5

3 6
33
Data, Control, & Management Planes
Processor

Switching
Fabric

Data Control Management

Time- Event Human


Packet (ns)
scale (10 ms to sec) (min to hours)
Forwarding,
buffering, Routing, Analysis,
Tasks filtering, signaling configuration
scheduling
Line-card Router Humans or
Location hardware software scripts
34
Cisco 8000 Series Routers

• Up to 648 400 GbE

• 260 Tbps backplane

35
Conclusions
• Physical devices sharing L2 & L3 networks have many
common features
– Forward table lookups
– Queueing and backplane switching
– Fast vs. slow paths
• Switches and routers separate routing decisions (control
plane) from forwarding actions (data plane)
• High speed necessitates innovation
– Specialized hardware
– Software algorithms
36

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy