Chapter_5_V6.01

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Chapter 5: Link layer

Chapter 5
our goals:
Link Layer ❖ understand principles behind link layer
services:
▪ error detection, correction
▪ sharing a broadcast channel: multiple access
A note on the use of these ppt slides:
We’re making these slides freely available to all (faculty, students, readers). Computer ▪ link layer addressing
They’re in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs. Networking: A Top ▪ local area networks: Ethernet, VLANs
They obviously represent a lot of work on our part. In return for use, we only
ask the following: Down Approach ❖ instantiation, implementation of various link
❖ If you use these slides (e.g., in a class) that you mention their source
6th edition
(after all, we’d like people to use our book!)
❖ If you post any slides on a www site, that you note that they are adapted Jim Kurose, Keith Ross layer technologies
from (or perhaps identical to) our slides, and note our copyright of this
material.
Addison-Wesley
March 2012
Thanks and enjoy! JFK/KWR

All material copyright 1996-2012


J.F Kurose and K.W. Ross, All Rights Reserved

Link Layer 5-1 Link Layer 5-2

Link layer, LANs: outline Link layer: introduction


terminology:
5.1 introduction, services 5.5 link virtualization: ❖ hosts and routers: nodes
5.2 error detection, MPLS ❖ communication channels that global ISP

correction 5.6 data center connect adjacent nodes along


5.3 multiple access networking communication path: links
protocols 5.7 a day in the life of a ▪ wired links
web request ▪ wireless links
5.4 LANs
▪ LANs
▪ addressing, ARP
❖ layer-2 packet: frame,
▪ Ethernet encapsulates datagram
▪ switches
▪ VLANS data-link layer has responsibility of
transferring datagram from one node
to physically adjacent node over a link
Link Layer 5-3 Link Layer 5-4

Link layer: context Link layer services


❖ datagram transferred by transportation analogy: ❖ framing, link access:
different link protocols over ❖ trip from Princeton to Lausanne ▪ encapsulate datagram into frame, adding header, trailer
different links: ▪ limo: Princeton to JFK ▪ channel access if shared medium
▪ e.g., Ethernet on first link, ▪ plane: JFK to Geneva ▪ “MAC” addresses used in frame headers to identify
frame relay on ▪ train: Geneva to Lausanne source, dest
intermediate links, 802.11 ❖ tourist = datagram • different from IP address!
on last link ❖ transport segment = ❖ reliable delivery between adjacent nodes
❖ each link protocol provides communication link ▪ we learned how to do this already (chapter 3)!
different services ❖ transportation mode = link ▪ seldom used on low bit-error link (fiber, some twisted
▪ e.g., may or may not layer protocol pair)
provide rdt over link ❖ travel agent = routing ▪ wireless links: high error rates
algorithm • Q: why both link-level and end-end reliability?

Link Layer 5-5 Link Layer 5-6

Link layer services (more) Where is the link layer implemented?


❖ in each and every host
❖ flow control: ❖ link layer implemented in
▪ pacing between adjacent sending and receiving nodes “adaptor” (aka network
❖ error detection: interface card NIC) or on a
chip
▪ errors caused by signal attenuation, noise. application

▪ receiver detects presence of errors: ▪ Ethernet card, 802.11 transport


network cpu memory

• signals sender for retransmission or drops frame


card; Ethernet chipset link

▪ implements link, physical


❖ error correction: layer controller
host
bus
▪ receiver identifies and corrects bit error(s) without resorting to link
(e.g., PCI)

retransmission ❖ attaches into host’s system physical


physical
buses transmission
❖ half-duplex and full-duplex ❖ combination of hardware,
▪ with half duplex, nodes at both ends of link can transmit, but not
at same time software, firmware network adapter
card

Link Layer 5-7 Link Layer 5-8


Adaptors communicating Link layer, LANs: outline
5.1 introduction, services 5.5 link virtualization:
datagram datagram
5.2 error detection, MPLS
controller controller
correction 5.6 data center
5.3 multiple access networking
sending host receiving host
datagram protocols 5.7 a day in the life of a
frame 5.4 LANs web request
▪ addressing, ARP
❖ sending side: ❖ receiving side
▪ Ethernet
▪ encapsulates datagram in ▪ looks for errors, rdt,
frame flow control, etc ▪ switches
▪ adds error checking bits, ▪ extracts datagram, passes ▪ VLANS
rdt, flow control, etc. to upper layer at
receiving side
Link Layer 5-9 Link Layer 5-10

Error detection Parity checking


EDC= Error Detection and Correction bits (redundancy)
single bit parity: two-dimensional bit parity:
D = Data protected by error checking, may include header fields
❖ detect single bit ❖ detect and correct single bit errors
errors
• Error detection not 100% reliable!
• protocol may miss some errors, but rarely
• larger EDC field yields better detection and correction

otherwise

0 0

Link Layer 5-11 Link Layer 5-12

Internet checksum (review) Cyclic redundancy check


❖ more powerful error-detection coding
goal: detect “errors” (e.g., flipped bits) in transmitted packet
(note: used at transport layer only) ❖ view data bits, D, as a binary number
❖ choose r+1 bit pattern (generator), G
sender: receiver: ❖ goal: choose r CRC bits, R, such that
❖ treat segment contents ❖ compute checksum of ▪ <D,R> exactly divisible by G (modulo 2)
as sequence of 16-bit received segment ▪ receiver knows G, divides <D,R> by G. If non-zero remainder:
integers ❖ check if computed
error detected!
❖ checksum: addition (1’s checksum equals checksum ▪ can detect all burst errors less than r+1 bits
complement sum) of field value: ❖ widely used in practice (Ethernet, 802.11 WiFi, ATM)
segment contents ▪ NO - error detected
❖ sender puts checksum ▪ YES - no error detected.
value into UDP But maybe errors
checksum field nonetheless?

Link Layer 5-13 Link Layer 5-14

CRC example Link layer, LANs: outline


want: G D r=3 5.1 introduction, services 5.5 link virtualization:
D.2r XOR R = nG 101000 MPLS
equivalently: 1001 101110000 5.2 error detection,
1001 correction 5.6 data center
D.2r = nG XOR R 101 networking
equivalently: 000
5.3 multiple access
protocols 5.7 a day in the life of a
if we divide D.2r by 1010
web request
G, want remainder R 1001 5.4 LANs
to satisfy: 010 ▪ addressing, ARP
000
100 ▪ Ethernet
R = remainder[
D.2r
] R
000 ▪ switches
G 1000 ▪ VLANS
0000
1000

Link Layer 5-15 Link Layer 5-16


Multiple access links, protocols Multiple access protocols
two types of “links”:
❖ single shared broadcast channel
❖ point-to-point
❖ two or more simultaneous transmissions by nodes:
▪ PPP for dial-up access
interference
▪ point-to-point link between Ethernet switch, host
▪ collision if node receives two or more signals at the same
❖ broadcast (shared wire or medium) time
▪ old-fashioned Ethernet
▪ upstream HFC
▪ 802.11 wireless LAN multiple access protocol
❖ distributed algorithm that determines how nodes share
channel, i.e., determine when node can transmit
❖ communication about channel sharing must use channel itself!
▪ no out-of-band channel for coordination

shared wire (e.g., shared RF shared RF humans at a


cabled Ethernet) (e.g., 802.11 WiFi) (satellite) cocktail party
(shared air, acoustical)

Link Layer 5-17 Link Layer 5-18

An ideal multiple access protocol MAC protocols: taxonomy


three broad classes:
given: broadcast channel of rate R bps
❖ channel partitioning
desiderata: ▪ divide channel into smaller “pieces” (time slots, frequency, code)
1. when one node wants to transmit, it can send at rate R. ▪ allocate piece to node for exclusive use
2. when M nodes want to transmit, each can send at average ❖ random access
rate R/M ▪ channel not divided, allow collisions
3. fully decentralized: ▪ “recover” from collisions
• no special node to coordinate transmissions ❖ “taking turns”
• no synchronization of clocks, slots ▪ nodes take turns, but nodes with more to send can take longer
turns
4. simple

Link Layer 5-19 Link Layer 5-20

Channel partitioning MAC protocols: TDMA Channel partitioning MAC protocols: FDMA
TDMA: time division multiple access FDMA: frequency division multiple access
❖ access to channel in "rounds" ❖ channel spectrum divided into frequency bands
❖ each station gets fixed length slot (length = pkt ❖ each station assigned fixed frequency band
trans time) in each round ❖ unused transmission time in frequency bands go idle
❖ unused slots go idle ❖ example: 6-station LAN, 1,3,4 have pkt, frequency bands 2,5,6
❖ example: 6-station LAN, 1,3,4 have pkt, slots idle
2,5,6 idle
frequency bands

6-slot 6-slot
frame frame
1 3 4 1 3 4

FDM cable

Link Layer 5-21 Link Layer 5-22

Random access protocols Slotted ALOHA


❖ when node has packet to send assumptions: operation:
▪ transmit at full channel data rate R. ❖ all frames same size ❖ when node obtains fresh
▪ no a priori coordination among nodes time divided into equal size frame, transmits in next slot
two or more transmitting nodes ➜ “collision”,

❖ slots (time to transmit 1 ▪ if no collision: node can send
❖ random access MAC protocol specifies: frame) new frame in next slot
▪ how to detect collisions ❖ nodes start to transmit ▪ if collision: node retransmits
▪ how to recover from collisions (e.g., via delayed only slot beginning frame in each subsequent
retransmissions) ❖ nodes are synchronized slot with prob. p until
❖ examples of random access MAC protocols: ❖ if 2 or more nodes transmit success
▪ slotted ALOHA in slot, all nodes detect
▪ ALOHA collision
▪ CSMA, CSMA/CD, CSMA/CA

Link Layer 5-23 Link Layer 5-24


Slotted ALOHA Slotted ALOHA: efficiency
node 1 1 1 1 1

efficiency: long-run ❖ max efficiency: find p* that


node 2 2 2 2
fraction of successful slots maximizes
node 3 3 3 3 (many nodes, all with many Np(1-p)N-1
frames to send) ❖ for many nodes, take limit
C E C S E C E S S of Np*(1-p*)N-1 as N goes
Pros: Cons: ❖ suppose: N nodes with to infinity, gives:
many frames to send, each max efficiency = 1/e = .37
❖ single active node can ❖ collisions, wasting slots transmits in slot with
continuously transmit at ❖ idle slots probability p
full rate of channel
❖ nodes may be able to prob that given node has at best: channel

!

❖ highly decentralized: only detect collision in less success in a slot = p(1- used for useful
slots in nodes need to be p)N-1 transmissions 37%
in sync than time to transmit
packet ❖ prob that any node has a of time!
❖ simple success = Np(1-p)N-1
❖ clock synchronization
Link Layer 5-25 Link Layer 5-26

Pure (unslotted) ALOHA Pure ALOHA efficiency


P(success by given node) = P(node transmits) .
❖ unslotted Aloha: simpler, no synchronization
P(no other node transmits in [t0-1,t0] .
❖ when frame first arrives P(no other node transmits in [t0-1,t0]
▪ transmit immediately
❖ collision probability increases: = p . (1-p)N-1 . (1-p)N-1
▪ frame sent at t0 collides with other frames sent in [t0- = p . (1-p)2(N-1)
1,t0+1]
… choosing optimum p and then letting n
= 1/(2e) = .18

even worse than slotted Aloha!

Link Layer 5-27 Link Layer 5-28

CSMA (carrier sense multiple access) CSMA collisions spatial layout of nodes

CSMA: listen before transmit: ❖ collisions can still occur:


propagation delay means
if channel sensed idle: transmit entire frame two nodes may not hear
❖ if channel sensed busy, defer transmission each other’s
transmission
❖ collision: entire packet
❖ human analogy: don’t interrupt others! transmission time
wasted
▪ distance & propagation
delay play role in in
determining collision
probability

Link Layer 5-29 Link Layer 5-30

CSMA/CD (collision detection) CSMA/CD (collision detection)


CSMA/CD: carrier sensing, deferral as in CSMA spatial layout of nodes
▪ collisions detected within short time
▪ colliding transmissions aborted, reducing channel wastage
❖ collision detection:
▪ easy in wired LANs: measure signal strengths, compare
transmitted, received signals
▪ difficult in wireless LANs: received signal strength
overwhelmed by local transmission strength
❖ human analogy: the polite conversationalist

Link Layer 5-31 Link Layer 5-32


Ethernet CSMA/CD algorithm CSMA/CD efficiency
1. NIC receives datagram 4. If NIC detects another ❖ Tprop = max prop delay between 2 nodes in LAN
from network layer, transmission while ❖ ttrans = time to transmit max-size frame
creates frame transmitting, aborts and
2. If NIC senses channel sends jam signal
idle, starts frame 5. After aborting, NIC 1
efficiency =
transmission. If NIC enters binary (exponential) 1 + 5t prop /ttrans
senses channel busy, backoff: ❖ efficiency goes to 1
waits until channel idle, ▪ after mth collision, NIC ▪ as tprop goes to 0
then transmits. chooses K at random ▪ as ttrans goes to infinity
3. If NIC transmits entire from {0,1,2, …, 2m-1}.
NIC waits K·512 bit ❖ better performance than ALOHA: and simple, cheap,
frame without detecting
times, returns to Step 2 decentralized!
another transmission,
NIC is done with frame ! ▪ longer backoff interval
with more collisions
Link Layer 5-33 Link Layer 5-34

“Taking turns” MAC protocols “Taking turns” MAC protocols


channel partitioning MAC protocols: polling:
▪ share channel efficiently and fairly at high load ❖ master node “invites”
▪ inefficient at low load: delay in channel access, 1/N slave nodes to transmit data
bandwidth allocated even if only 1 active node! in turn poll
❖ typically used with
random access MAC protocols “dumb” slave devices master
▪ efficient at low load: single node can fully utilize ❖ concerns:
data
channel
▪ polling overhead
▪ high load: collision overhead
▪ latency
“taking turns” protocols ▪ single point of slaves
look for best of both worlds! failure (master)

Link Layer 5-35 Link Layer 5-36

“Taking turns” MAC protocols Cable access network


Internet frames,TV channels, control transmitted
token passing: downstream at different frequencies
T
❖ control token passed cable headend
from one node to next
sequentially. CMTS

❖ token message cable
❖ concerns:
(nothing
to send) cable modem … splitter
modem
termination system
▪ token overhead T
ISP
▪ latency upstream Internet frames, TV control, transmitted
upstream at different frequencies in time slots
▪ single point of failure
(token) ❖ multiple 40Mbps downstream (broadcast) channels
▪ single CMTS transmits into channels
❖ multiple 30 Mbps upstream channels
data ▪ multiple access: all users contend for certain upstream
Link Layer 5-37
channel time slots (others assigned)

Cable access network Summary of MAC protocols


cable headend MAP frame for
Interval [t1, t2]

Downstream channel i
❖ channel partitioning, by time, frequency or code
CMTS ▪ Time Division, Frequency Division
Upstream channel j
❖ random access (dynamic),
▪ ALOHA, S-ALOHA, CSMA, CSMA/CD
t1 t2 Residences with cable modems
▪ carrier sensing: easy in some technologies (wire), hard
Minislots containing Assigned minislots containing cable modem in others (wireless)
minislots request frames upstream data frames
▪ CSMA/CD used in Ethernet
DOCSIS: data over cable service interface spec ▪ CSMA/CA used in 802.11
❖ FDM over upstream, downstream frequency channels ❖ taking turns
❖ TDM upstream: some slots assigned, some have contention ▪ polling from central site, token passing
▪ downstream MAP frame: assigns upstream slots ▪ bluetooth, FDDI, token ring
▪ request for upstream slots (and data) transmitted
random access (binary backoff) in selected slots
Link Layer 5-39 Link Layer 5-40
Link layer, LANs: outline MAC addresses and ARP
5.1 introduction, services 5.5 link virtualization: ❖ 32-bit IP address:
5.2 error detection, MPLS ▪ network-layer address for interface
correction 5.6 data center ▪ used for layer 3 (network layer) forwarding
5.3 multiple access networking ❖ MAC (or LAN or physical or Ethernet) address:
protocols 5.7 a day in the life of a ▪ function: used ‘locally” to get frame from one interface to
5.4 LANs web request another physically-connected interface (same network, in IP-
addressing sense)
▪ addressing, ARP
▪ 48 bit MAC address (for most LANs) burned in NIC
▪ Ethernet ROM, also sometimes software settable
▪ switches ▪ e.g.: 1A-2F-BB-76-09-AD
▪ VLANS
hexadecimal (base 16) notation
(each “number” represents 4 bits)

Link Layer 5-41 Link Layer 5-42

LAN addresses and ARP LAN addresses (more)


each adapter on LAN has unique LAN address
❖ MAC address allocation administered by IEEE
❖ manufacturer buys portion of MAC address space
1A-2F-BB-76-09-AD (to assure uniqueness)
❖ analogy:
▪ MAC address: like Social Security Number
LAN ▪ IP address: like postal address
MAC flat address ➜ portability
(wired or adapter
wireless) ❖
71-65-F7-2B-08-53
58-23-D7-FA-20-B0 ▪ can move LAN card from one LAN to another
❖ IP hierarchical address not portable
0C-C4-11-6F-E3-98
▪ address depends on IP subnet to which node is
attached

Link Layer 5-43 Link Layer 5-44

ARP: address resolution protocol ARP protocol: same LAN


Question: how to determine ❖ A wants to send datagram
interface’s MAC address, to B
▪ B’s MAC address not in ❖ A caches (saves) IP-to-
knowing its IP address? ARP table: each IP node (host, A’s ARP table. MAC address pair in its
router) on LAN has table ❖ A broadcasts ARP query ARP table until
137.196.7.78
▪ IP/MAC address packet, containing B's IP information becomes old
mappings for some LAN address (times out)
1A-2F-BB-76-09-AD
nodes: ▪ dest MAC address = FF-FF- ▪ soft state: information that
137.196.7.23
137.196.7.14 < IP address; MAC address; TTL> FF-FF-FF-FF times out (goes away)
unless refreshed
▪ TTL (Time To Live): ▪ all nodes on LAN receive
LAN time after which address ARP query ❖ ARP is “plug-and-play”:
71-65-F7-2B-08-53 mapping will be ❖ B receives ARP packet, ▪ nodes create their ARP
58-23-D7-FA-20-B0
forgotten (typically 20 replies to A with its (B's) tables without intervention
from net administrator
min) MAC address
0C-C4-11-6F-E3-98
137.196.7.88
▪ frame sent to A’s MAC
address (unicast)
Link Layer 5-45 Link Layer 5-46

Addressing: routing to another LAN Addressing: routing to another LAN


walkthrough: send datagram from A to B via R ❖ A creates IP datagram with IP source A, destination B
▪ focus on addressing – at IP (datagram) and MAC layer (frame) ❖ A creates link-layer frame with R's MAC address as dest, frame
contains A-to-B IP datagram
▪ assume A knows B’s IP address
▪ assume A knows IP address of first hop router, R (how?) MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
▪ assume A knows R’s MAC address (how?) IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Eth
Phy

A B A B
R R
111.111.111.111 111.111.111.111
222.222.222.222 222.222.222.222
74-29-9C-E8-FF-55 74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221 111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

Link Layer 5-47 Link Layer 5-48


Addressing: routing to another LAN Addressing: routing to another LAN
❖ frame sent from A to R ❖ R forwards datagram with IP source A, destination B
❖ frame received at R, datagram removed, passed up to IP ❖ R creates link-layer frame with B's MAC address as dest, frame
contains A-to-B IP datagram
MAC src: 74-29-9C-E8-FF-55 MAC src: 1A-23-F9-CD-06-9B
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111 MAC dest: 49-BD-D2-C7-56-2A
IP dest: 222.222.222.222
IP src: 111.111.111.111 IP src: 111.111.111.111
IP dest: 222.222.222.222 IP dest: 222.222.222.222
IP
IP IP IP Eth
Eth Eth Eth Phy
Phy Phy Phy

A B A B
R R
111.111.111.111 111.111.111.111
222.222.222.222 222.222.222.222
74-29-9C-E8-FF-55 74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221 111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

Link Layer 5-49 Link Layer 5-50

Addressing: routing to another LAN Addressing: routing to another LAN


❖ R forwards datagram with IP source A, destination B ❖ R forwards datagram with IP source A, destination B
❖ R creates link-layer frame with B's MAC address as dest, frame ❖ R creates link-layer frame with B's MAC address as dest, frame
contains A-to-B IP datagram contains A-to-B IP datagram
MAC src: 1A-23-F9-CD-06-9B
MAC src: 1A-23-F9-CD-06-9B MAC dest: 49-BD-D2-C7-56-2A
MAC dest: 49-BD-D2-C7-56-2A IP src: 111.111.111.111
IP src: 111.111.111.111 IP dest: 222.222.222.222
IP dest: 222.222.222.222
IP IP
IP Eth Eth
Eth Phy Phy
Phy

A B A B
R R
111.111.111.111 111.111.111.111
222.222.222.222 222.222.222.222
74-29-9C-E8-FF-55 74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A 49-BD-D2-C7-56-2A
222.222.222.220 222.222.222.220
1A-23-F9-CD-06-9B 1A-23-F9-CD-06-9B

111.111.111.112 111.111.111.110 222.222.222.221 111.111.111.112 111.111.111.110 222.222.222.221


CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 88-B2-2F-54-1A-0F

Link Layer 5-51 Link Layer 5-52

Link layer, LANs: outline Ethernet


“dominant” wired LAN technology:
5.1 introduction, services 5.5 link virtualization: ❖ cheap $20 for NIC

5.2 error detection, MPLS ❖ first widely used LAN technology

correction 5.6 data center ❖ simpler, cheaper than token LANs and ATM

5.3 multiple access networking ❖ kept up with speed race: 10 Mbps – 10 Gbps

protocols 5.7 a day in the life of a


5.4 LANs web request
▪ addressing, ARP
▪ Ethernet
▪ switches
▪ VLANS

Metcalfe’s Ethernet sketch


Link Layer 5-53 Link Layer 5-54

Ethernet: physical topology Ethernet frame structure


❖ bus: popular through mid 90s
▪ all nodes in same collision domain (can collide with each
other) sending adapter encapsulates IP datagram (or other
❖ star: prevails today network layer protocol packet) in Ethernet frame
type
▪ active switch in center
dest. source data
preamble address address CRC
▪ each “spoke” runs a (separate) Ethernet protocol (nodes (payload)

do not collide with each other)


preamble:
❖ 7 bytes with pattern 10101010 followed by one
byte with pattern 10101011
❖ used to synchronize receiver, sender clock rates

switch
star
bus: coaxial cable
Link Layer 5-55 Link Layer 5-56
Ethernet frame structure (more) Ethernet: unreliable, connectionless
❖ addresses: 6 byte source, destination MAC addresses
▪ if adapter receives frame with matching destination ❖ connectionless: no handshaking between sending and
address, or with broadcast address (e.g. ARP packet), it receiving NICs
passes data in frame to network layer protocol ❖ unreliable: receiving NIC doesnt send acks or nacks
▪ otherwise, adapter discards frame to sending NIC
❖ type: indicates higher layer protocol (mostly IP but ▪ data in dropped frames recovered only if initial
others possible, e.g., Novell IPX, AppleTalk) sender uses higher layer rdt (e.g., TCP), otherwise
❖ CRC: cyclic redundancy check at receiver dropped data lost
▪ error detected: frame is dropped ❖ Ethernet’s MAC protocol: unslotted CSMA/CD wth
binary backoff
type
dest. source data
preamble address address (payload) CRC

Link Layer 5-57 Link Layer 5-58

802.3 Ethernet standards: link & physical layers Link layer, LANs: outline
❖ many different Ethernet standards
▪ common MAC protocol and frame format 5.1 introduction, services 5.5 link virtualization:
▪ different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 5.2 error detection, MPLS
10G bps correction 5.6 data center
▪ different physical layer media: fiber, cable 5.3 multiple access networking
protocols 5.7 a day in the life of a
5.4 LANs web request
application
MAC protocol ▪ addressing, ARP
and frame format
transport ▪ Ethernet
network 100BASE-TX 100BASE-T2 100BASE-FX
link
▪ switches
100BASE-T4 100BASE-SX 100BASE-BX
physical ▪ VLANS

copper (twister fiber physical layer


pair) physical layer
Link Layer 5-59 Link Layer 5-60

Ethernet switch Switch: multiple simultaneous transmissions


❖ link-layer device: takes an active role
▪ store, forward Ethernet frames ❖ hosts have dedicated, direct A
connection to switch
▪ examine incoming frame’s MAC address, ❖ switches buffer packets C’ B
selectively forward frame to one-or-more ❖ Ethernet protocol used on each 1
outgoing links when frame is to be forwarded on incoming link, but no collisions;
6 2
segment, uses CSMA/CD to access segment full duplex 4
5 3
❖ transparent ▪ each link is its own collision
B’ C
▪ hosts are unaware of presence of switches domain
❖ plug-and-play, self-learning ❖ switching: A-to-A’ and B-to-B’
can transmit simultaneously, A’
▪ switches do not need to be configured without collisions switch with six interfaces
(1,2,3,4,5,6)

Link Layer 5-61 Link Layer 5-62

Switch forwarding table Switch: self-learning Source: A


Dest: A’

A A A’
Q: how does switch know A’ A ❖ switch learns which hosts
can be reached through
reachable via interface 4, B’ B which interfaces C’ B
C’
reachable via interface 5? ▪ when frame received, 6 1 2
❖ A: each switch has a switch 6 1 2 switch “learns”
table, each entry: location of sender: 5 4 3
5 4 3 incoming LAN segment
▪ (MAC address of host, interface to
▪ records sender/location B’ C
reach host, time stamp) B’ C
pair in switch table
▪ looks like a routing table!
A’
A’
Q: how are entries created, switch with six interfaces MAC addr interface TTL
maintained in switch table? (1,2,3,4,5,6) A 1 60 Switch table
(initially empty)
▪ something like a routing protocol?

Link Layer 5-63 Link Layer 5-64


Switch: frame filtering/forwarding Self-learning, forwarding: example Source: A
Dest: A’

A A A’
when frame received at switch: ❖ frame destination, A’,
C’ B
locaton unknown: flood
1. record incoming link, MAC address of sending host
1
2. index switch table using MAC destination address ❖ destination A location 6 2

3. if entry found for destination known: selectively send A A’


5 4 3
then {
on just one link C
if destination on segment from which frame arrived B’
then drop frame A’ A
else forward frame on interface indicated by entry A’
}
MAC addr interface TTL
else flood /* forward on all interfaces except arriving
A 1 60 switch table
interface */ (initially empty)
A’ 4 60

Link Layer 5-65 Link Layer 5-66

Interconnecting switches Self-learning multi-switch example


Suppose C sends frame to I, I responds to C
❖ switches can be connected together
S4 S4

S1 S1
S3 S3
A S2 A S2
F F
D I D I
B C B C
G H G H
E E

Q: sending from A to G - how does S1 know to ❖ Q: show switch tables and packet forwarding in S1, S2, S3, S4
forward frame destined to F via S4 and S3?
❖ A: self learning! (works exactly the same as in
single-switch case!)
Link Layer 5-67 Link Layer 5-68

Institutional network Switches vs. routers


application
transport
both are store-and-forward:
datagram network
mail server ▪ routers: network-layer frame link
to external devices (examine network- physical link frame
network layer headers) physical
router web server
▪ switches: link-layer devices
(examine link-layer switch
headers)
IP subnet network datagram
both have forwarding tables: link frame
physical
▪ routers: compute tables
using routing algorithms, IP application
addresses transport
▪ switches: learn forwarding network
table using flooding, link
learning, MAC addresses physical

Link Layer 5-69 Link Layer 5-70

port-based VLAN: switch ports


VLANs: motivation VLANs grouped (by switch management
software) so that single physical
consider: switch ……
Virtual Local
❖ CS user moves office to Area Network
1
2
7

8
9

10
15

16
EE, but wants connect to
CS switch? switch(es) supporting
VLAN capabilities can … …
❖ single broadcast domain:
be configured to
▪ all layer-2 broadcast Electrical Engineering Computer Science
define multiple virtual (VLAN ports 1-8) (VLAN ports 9-15)
traffic (ARP, DHCP,
unknown location of
LANS over single … operates as multiple virtual switches
Computer
Computer physical LAN
Science Electrical Engineering
destination MAC
Engineering address) must cross infrastructure. 1 7 9 15

entire LAN 2 8 10 16

▪ security/privacy, … …
efficiency issues
Electrical Engineering Computer Science
(VLAN ports 1-8) (VLAN ports 9-16)

Link Layer 5-71 Link Layer 5-72


Port-based VLAN VLANS spanning multiple switches
router
❖ traffic isolation: frames to/from
ports 1-8 can only reach ports 1 7 9 15 1 3 5 7

1-8 2 8 10 16 2 4 6 8

▪ can also define VLAN based on


MAC addresses of endpoints, … …
rather than switch port 1 7 9 15

2 8 10 16
Electrical Engineering Computer Science Ports 2,3,5 belong to EE VLAN
❖ dynamic membership: ports (VLAN ports 1-8) (VLAN ports 9-15) Ports 4,6,7,8 belong to CS VLAN

can be dynamically assigned … …


among VLANs Electrical Engineering Computer Science ❖ trunk port: carries frames between VLANS defined over
(VLAN ports 1-8) (VLAN ports 9-15)
multiple physical switches
❖ forwarding between VLANS: done via ▪ frames forwarded within VLAN between switches can’t be vanilla
routing (just as with separate 802.1 frames (must carry VLAN ID info)
switches) ▪ 802.1q protocol adds/removed additional header fields for frames
▪ in practice vendors sell combined forwarded between trunk ports
switches plus routers

Link Layer 5-73 Link Layer 5-74

802.1Q VLAN frame format Link layer, LANs: outline


type

preamble dest.
address
source
address
data (payload) CRC
802.1 frame
5.1 introduction, services 5.5 link virtualization:
5.2 error detection, MPLS
type
correction 5.6 data center
preamble dest. source data (payload) CRC 802.1Q frame 5.3 multiple access networking
address address
protocols 5.7 a day in the life of a
5.4 LANs web request
2-byte Tag Protocol Identifier
(value: 81-00)
Recomputed ▪ addressing, ARP
CRC
▪ Ethernet
▪ switches
Tag Control Information (12 bit VLAN ID field,
3 bit priority field like IP TOS)
▪ VLANS

Link Layer 5-75 Link Layer 5-76

Multiprotocol label switching (MPLS) MPLS capable routers


❖ initial goal: high-speed IP forwarding using fixed
length label (instead of IP address) ❖ a.k.a. label-switched router
▪ fast lookup using fixed length identifier (rather than ❖ forward packets to outgoing interface based only on
shortest prefix matching) label value (don’t inspect IP address)
▪ borrowing ideas from Virtual Circuit (VC) approach ▪ MPLS forwarding table distinct from IP forwarding tables
▪ but IP datagram still keeps IP address! ❖ flexibility: MPLS forwarding decisions can differ from
those of IP
PPP or Ethernet
IP header remainder of link-layer frame
▪ use destination and source addresses to route flows to
MPLS header
header same destination differently (traffic engineering)
▪ re-route flows quickly if link fails: pre-computed backup
paths (useful for VoIP)
label Exp S TTL

20 3 1 5
Link Layer 5-77 Link Layer 5-78

MPLS versus IP paths MPLS versus IP paths


entry router (R4) can use different MPLS
routes to A based, e.g., on source address
R6 R6
D D
R4 R3 R4 R3
R5 R5
A A
R2 R2

❖ IP routing: path to destination determined ❖ IP routing: path to destination determined IP-only


IP router
by destination address alone by destination address alone router

❖ MPLS routing: path to destination can be MPLS and


IP router
based on source and dest. address
▪ fast reroute: precompute backup routes in
case of link failure
Link Layer 5-79 Link Layer 5-80
MPLS signaling MPLS forwarding tables
❖ modify OSPF, IS-IS link-state flooding protocols to in out out
carry info used by MPLS routing, label label dest interface

▪ e.g., link bandwidth, amount of “reserved” link bandwidth 10 A 0 in out out


12 D 0 label label dest interface
❖ entry MPLS router uses RSVP-TE signaling protocol to set 8 A 1 10 6 A 1
up MPLS forwarding at downstream routers 12 9 D 0

R6
0 0
D
RSVP-TE 1 1
R6 R4 R3
D R5
R4 0 0
A
R5 modified R2 in outR1 out
link state label label dest interface
A in out out
flooding label label dest interface 6 - A 0
8 6 A 0
Link Layer 5-81 Link Layer 5-82

Link layer, LANs: outline Data center networks


❖ 10’s to 100’s of thousands of hosts, often closely
5.1 introduction, services 5.5 link virtualization: coupled, in close proximity:
5.2 error detection, MPLS ▪ e-business (e.g. Amazon)
correction 5.6 data center ▪ content-servers (e.g., YouTube, Akamai, Apple, Microsoft)
5.3 multiple access networking ▪ search engines, data mining (e.g., Google)
protocols 5.7 a day in the life of a
web request ❖ challenges:
5.4 LANs ▪ multiple applications, each
▪ addressing, ARP serving massive numbers of
▪ Ethernet clients
▪ switches ▪ managing/balancing load,
▪ VLANS avoiding processing,
networking, data bottlenecks
Inside a 40-ft Microsoft container,
Chicago data center
Link Layer 5-83 Link Layer 5-84

Data center networks Data center networks


load balancer: application-layer routing ❖ rich interconnection among switches, racks:
▪ receives external client requests
▪ directs workload within data center
▪ increased throughput between racks (multiple routing
▪ returns results to external client (hiding data paths possible)
Internet center internals from client) ▪ increased reliability via redundancy
Border router
Load Load
Access router Tier-1 switches
balancer balancer

Tier-1 switches
B
Tier-2 switches

A C Tier-2 switches

TOR switches TOR switches

Server racks Server racks

1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8

Link Layer 5-85

Link layer, LANs: outline Synthesis: a day in the life of a web request
❖ journey down protocol stack complete!
5.1 introduction, services 5.5 link virtualization: ▪ application, transport, network, link
5.2 error detection, MPLS
❖ putting-it-all-together: synthesis!
correction 5.6 data center ▪ goal: identify, review, understand protocols (at all
5.3 multiple access networking layers) involved in seemingly simple scenario:
protocols 5.7 a day in the life of a requesting www page
5.4 LANs web request ▪ scenario: student attaches laptop to campus network,
requests/receives www.google.com
▪ addressing, ARP
▪ Ethernet
▪ switches
▪ VLANS

Link Layer 5-87 Link Layer 5-88


A day in the life: scenario A day in the life… connecting to the Internet
DHCP DHCP ❖ connecting laptop needs to
UDP
browser DNS server DHCP
DHCP IP
get its own IP address, addr
Comcast network DHCP Eth of first-hop router, addr of
68.80.0.0/13 Phy DNS server: use DHCP
DHCP

❖ DHCP request encapsulated


in UDP, encapsulated in IP,
school network DHCP
DHCP
DHCP UDP
encapsulated in 802.3
68.80.2.0/24
DHCP IP Ethernet
DHCP Eth router
web page
Phy (runs DHCP) ❖ Ethernet frame broadcast
(dest: FFFFFFFFFFFF) on LAN,
received at router running
web server Google’s network DHCP server
64.233.169.105 64.233.160.0/19 ❖ Ethernet demuxed to IP
demuxed, UDP demuxed to
DHCP
Link Layer 5-89 Link Layer 5-90

A day in the life… connecting to the Internet A day in the life… ARP (before DNS, before HTTP)
DHCP DHCP ❖ DHCP server formulates DNS DNS ❖ before sending HTTP request, need
DHCP UDP DHCP ACK containing DNS UDP IP address of www.google.com:
DHCP IP client’s IP address, IP DNS
ARP
IP DNS
DHCP Eth address of first-hop router ARP query Eth
Phy for client, name & IP Phy ❖ DNS query created, encapsulated in
address of DNS server UDP, encapsulated in IP,
❖ encapsulation at DHCP encapsulated in Eth. To send frame
DHCP server, frame forwarded ARP
to router, need MAC address of
DHCP ARP reply Eth
DHCP UDP (switch learning) through Phy router interface: ARP
DHCP IP LAN, demultiplexing at
DHCP Eth router client router ❖ ARP query broadcast, received by
Phy (runs DHCP)
❖ DHCP client receives (runs DHCP) router, which replies with ARP
DHCP
DHCP ACK reply reply giving MAC address of
router interface
❖ client now knows MAC address
Client now has IP address, knows name & addr of DNS of first hop router, so can now
server, IP address of its first-hop router send frame containing DNS
query
Link Layer 5-91 Link Layer 5-92

A day in the life… using DNS DNS A day in the life…TCP connection carrying HTTP
DNS UDP DNS server
DNS IP HTTP
DNS DNS DNS Eth HTTP
DNS UDP DNS Phy
SYNACK
SYN TCP
DNS IP SYNACK
SYN IP
DNS Eth SYNACK
SYN Eth
Phy Phy
DNS
Comcast network
68.80.0.0/13
❖ to send HTTP request,
client first opens TCP socket
to web server
❖ IP datagram forwarded from
router router ❖ TCP SYN segment (step 1 in 3-
(runs DHCP) campus network into comcast (runs DHCP)
way handshake) inter-domain
network, routed (tables created SYNACK
SYN TCP
❖ IP datagram containing DNS SYNACK
SYN IP routed to web server
query forwarded via LAN by RIP, OSPF, IS-IS and/or BGP SYNACK
SYN Eth
switch from client to 1st hop routing protocols) to DNS server Phy ❖ web server responds with TCP
router SYNACK (step 2 in 3-way
❖ demux’ed to DNS server
web server handshake)
❖ DNS server replies to client 64.233.169.105
with IP address of ❖ TCP connection established!
www.google.com Link Layer 5-93 Link Layer 5-94

A day in the life… HTTP request/reply


HTTP ❖ web page finally (!!!) displayed
Chapter 5: Summary
HTTP HTTP
TCP
HTTP
HTTP
HTTP
HTTP IP
❖ principles behind data link layer services:
HTTP
HTTP Eth ▪ error detection, correction
Phy
▪ sharing a broadcast channel: multiple access
▪ link layer addressing
❖ HTTP request sent into TCP ❖ instantiation and implementation of various link
socket layer technologies
router ❖ IP datagram containing HTTP ▪ Ethernet
HTTP HTTP (runs DHCP)
HTTP TCP
request routed to ▪ switched LANS, VLANs
www.google.com
IP
▪ virtualized networks as a link layer: MPLS
HTTP

HTTP Eth ❖ web server responds with


Phy HTTP reply (containing web ❖ synthesis: a day in the life of a web request
page)
web server
64.233.169.105
❖ IP datagram containing HTTP
reply routed back to client
Link Layer 5-95 Link Layer 5-96
Chapter 5: let’s take a breath
❖ journey down protocol stack complete (except
PHY)
❖ solid understanding of networking principles,
practice
❖ ….. could stop here …. but lots of interesting
topics!
▪ wireless
▪ multimedia
▪ security
▪ network management

Link Layer 5-97

You might also like