Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CSE 3711 Lecture-No.6 (Summer 2023)

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 45

Chapter 6

Data Link Layer


(Sec – 6.1.1, 6.3, 6.4.1 &
6.4.3)
Instructor: Mohammad Mamun Elahi
Office: 5th Floor (Room # 522)
Email: mmelahi@cse.uiu.ac.bd Computer
Class Location: http://meet.google.com/rca-cwkd-cmh Networking: A Top
Lectures: S W 12:10 pm (Sec A), 2-00 pm (Sec C) Down Approach
Notes derived from “Computer Networking: A Top 7th edition
Down Approach”, Jim Kurose, Keith Ross, Jim Kurose, Keith Ross
Addison-Wesley. Addison-Wesley
March 2017
Slides are adapted from the companion web site of
the book, as modified by Mohammad Mamun
Elahi.
Introduction1-1
Link layer and LANs: our goals
 understand principles  instantiation, implementation
behind link layer services: of various link layer
• error detection, correction technologies
• sharing a broadcast channel:
multiple access
• link layer addressing
• local area networks:
Ethernet, VLANs
 datacenter networks

Link Layer: 6-2


Link layer, LANs: roadmap
 introduction
 error detection, correction
 multiple access protocols
 LANs
• addressing, ARP
• Ethernet
• switches
• VLANs
 a day in the life of a web
 link virtualization: MPLS request
 data center networking
Link Layer: 6-3
Link layer: introduction
terminology: mobile network

 hosts and routers: nodes national or global ISP

 communication channels that


connect adjacent nodes along
communication path: links
• wired
• wireless
• LANs
 layer-2 packet: frame, datacenter
network

encapsulates datagram
link layer has responsibility of
transferring datagram from one node enterprise
network
to physically adjacent node over a link
Link Layer: 6-4
Link layer: context
 datagram transferred by transportation analogy:
different link protocols over  trip from Princeton to Lausanne
different links: • limo: Princeton to JFK
• e.g., WiFi on first link, Ethernet • plane: JFK to Geneva
on next link • train: Geneva to Lausanne

 each link protocol provides  tourist = datagram


different services  transport segment =
• e.g., may or may not provide communication link
reliable data transfer over link  transportation mode = link-layer
protocol
 travel agent = routing algorithm

Link Layer: 6-5


Link layer: services
 framing, link access: …
• encapsulate datagram into frame, adding …
header, trailer
• channel access if shared medium
• “MAC” addresses in frame headers identify
source, destination (different from IP
address!)
 reliable delivery between adjacent nodes
• we already know how to do this!
• seldom used on low bit-error links
• wireless links: high error rates
• Q: why both link-level and end-end
reliability?
Link Layer: 6-6
Link layer: services (more)
 flow control: …
• pacing between adjacent sending and …
receiving nodes
 error detection:
• errors caused by signal attenuation, noise.
• receiver detects errors, signals
retransmission, or drops frame
 error correction:
• receiver identifies and corrects bit error(s)
without retransmission
 half-duplex and full-duplex:
• with half duplex, nodes at both ends of
link can transmit, but not at same time Link Layer: 6-7
Where is the link layer implemented?
 in each-and-every host
 link layer implemented in
network interface card (NIC) or
on a chip
application
transport
cpu memory
network

• Ethernet, WiFi card or chip link

• implements link, physical layer controller


host bus
(e.g., PCI)
link
 attaches into host’s system buses physical
physical

 combination of hardware,
software, firmware network interface

Link Layer: 6-8


Multiple access links, protocols
two types of “links”:
 point-to-point
• point-to-point link between Ethernet switch, host
• PPP for dial-up access
 broadcast (shared wire or medium)
• old-fashioned Ethernet
• upstream HFC in cable-based access network
• 802.11 wireless LAN, 4G/4G. satellite

shared wire (e.g., humans at a cocktail party


cabled Ethernet) shared radio: 4G/5G shared radio: WiFi shared radio: satellite
(shared air, acoustical)

Link Layer: 6-9


Multiple access protocols
 single shared broadcast channel
 two or more simultaneous transmissions by nodes: interference
• collision if node receives two or more signals at the same time

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

Link Layer: 6-10


MAC protocols: taxonomy
three broad classes:
 channel partitioning
• divide channel into smaller “pieces” (time slots, frequency, code)
• allocate piece to node for exclusive use
 random access
• channel not divided, allow collisions
• “recover” from collisions
 “taking turns”
• nodes take turns, but nodes with more to send can take longer turns

Link Layer: 6-11


Channel partitioning MAC protocols: TDMA
TDMA: time division multiple access
 access to channel in “rounds”
 each station gets fixed length slot (length = packet transmission
time) in each round
 unused slots go idle
 example: 6-station LAN, 1,3,4 have packets to send, slots 2,5,6 idle

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

Link Layer: 6-12


Channel partitioning MAC protocols: FDMA
FDMA: frequency division multiple access
 channel spectrum divided into frequency bands
 each station assigned fixed frequency band
 unused transmission time in frequency bands go idle
 example: 6-station LAN, 1,3,4 have packet to send, frequency bands 2,5,6 idle
time

frequency bands
FDM cable

Link Layer: 6-13


Random access protocols
 when node has packet to send
• transmit at full channel data rate R.
• no a priori coordination among nodes
 two or more transmitting nodes: “collision”
 random access MAC protocol specifies:
• how to detect collisions
• how to recover from collisions (e.g., via delayed retransmissions)
 examples of random access MAC protocols:
• ALOHA, slotted ALOHA
• CSMA, CSMA/CD, CSMA/CA

Link Layer: 6-14


CSMA (carrier sense multiple access)
simple CSMA: listen before transmit:
• if channel sensed idle: transmit entire frame
• if channel sensed busy: defer transmission
 human analogy: don’t interrupt others!

CSMA/CD: CSMA with collision detection


• collisions detected within short time
• colliding transmissions aborted, reducing channel wastage
• collision detection easy in wired, difficult with wireless
 human analogy: the polite conversationalist

Link Layer: 6-15


“Taking turns” MAC protocols
channel partitioning MAC protocols:
 share channel efficiently and fairly at high load
 inefficient at low load: delay in channel access, 1/N bandwidth
allocated even if only 1 active node!
random access MAC protocols
 efficient at low load: single node can fully utilize channel
 high load: collision overhead
“taking turns” protocols
 look for best of both worlds!

Link Layer: 6-16


“Taking turns” MAC protocols
polling:
 master node “invites” other nodes
to transmit in turn data
poll
 typically used with “dumb”
devices master
 concerns: data

• polling overhead
• latency
• single point of failure (master) slaves

Link Layer: 6-17


“Taking turns” MAC protocols
T
token passing:
 control token passed from one
node to next sequentially.
(nothing
 token message to send)
 concerns: T
• token overhead
• latency
• single point of failure
(token)
data

Link Layer: 6-18


MAC addresses
 32-bit IP address:
• network-layer address for interface
• used for layer 3 (network layer) forwarding
• e.g.: 128.119.40.136
 MAC (or LAN or physical or Ethernet) address:
• function: used “locally” to get frame from one interface to another
physically-connected interface (same subnet, in IP-addressing sense)
• 48-bit MAC address (for most LANs) burned in NIC ROM, also
sometimes software settable
• e.g.: 1A-2F-BB-76-09-AD
hexadecimal (base 16) notation
(each “numeral” represents 4 bits)
Link Layer: 6-19
MAC addresses
each interface on LAN
 has unique 48-bit MAC address
 has a locally unique 32-bit IP address (as we’ve seen)

137.196.7.78
1A-2F-BB-76-09-AD

LAN
(wired or wireless)
137.196.7/24
71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14

0C-C4-11-6F-E3-98
137.196.7.88

Link Layer: 6-20


ARP: address resolution protocol
Question: how to determine interface’s MAC address, knowing its IP
address?
ARP table: each IP node (host,
ARP
router) on LAN has table
137.196.7.78
ARP
1A-2F-BB-76-09-AD • IP/MAC address mappings for
ARP some LAN nodes:
LAN < IP address; MAC address; TTL>
71-65-F7-2B-08-53
137.196.7.23
58-23-D7-FA-20-B0
137.196.7.14 • TTL (Time To Live): time after
ARP 0C-C4-11-6F-E3-98 which address mapping will be
137.196.7.88
forgotten (typically 20 min)

Link Layer: 6-21


ARP protocol in action
example: A wants to send datagram to B
• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address

A broadcasts ARP query, containing B's IP addr


Ethernet frame (sent to FF-FF-FF-FF-FF-FF)
1 • destination MAC address = FF-FF-FF-FF-FF-FF
• all nodes on LAN receive ARP query C Source MAC: 71-65-F7-2B-08-53
Source IP: 137.196.7.23
ARP table in A Target IP address: 137.196.7.14

IP addr MAC addr TTL
TTL
A B
1
71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14

D
Link Layer: 6-22
ARP protocol in action
example: A wants to send datagram to B
• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address

ARP message into Ethernet frame


(sent to 71-65-F7-2B-08-53)
C Target IP address: 137.196.7.14
Target MAC address:
ARP table in A 58-23-D7-FA-20-B0

IP addr MAC addr TTL
TTL
A B
2
71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14

2 B replies to A with ARP response,


giving its MAC address
D
Link Layer: 6-23
ARP protocol in action
example: A wants to send datagram to B
• B’s MAC address not in A’s ARP table, so A uses ARP to find B’s MAC address

C
ARP table in A
IP addr MAC addr TTL
TTL
137.196. 58-23-D7-FA-20-B0 500
A B
7.14

71-65-F7-2B-08-53 58-23-D7-FA-20-B0
137.196.7.23 137.196.7.14

3 A receives B’s reply, adds B entry


into its local ARP table
D
Link Layer: 6-24
Routing to another subnet: addressing
walkthrough: sending a datagram from A to B via R
 focus on addressing – at IP (datagram) and MAC layer (frame) levels
 assume that:
• A knows B’s IP address
• A knows IP address of first hop router, R (how?)
• A knows R’s MAC address (how?)

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-25
Routing to another subnet: addressing
 A creates IP datagram with IP source A, destination B
 A creates link-layer frame containing A-to-B IP datagram
• R's MAC address is frame’s destination
MAC src: 74-29-9C-E8-FF-55
MAC dest: E6-E9-00-17-BB-4B
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Eth
Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-26
Routing to another subnet: addressing
 frame sent from A to R
 frame received at R, datagram removed, passed up to IP

MAC src: 74-29-9C-E8-FF-55


IP src: 111.111.111.111
MAC dest: E6-E9-00-17-BB-4B
IP dest: 222.222.222.222
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP IP
Eth Eth
Phy Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-27
Routing to another subnet: addressing
 R determines outgoing interface, passes datagram with IP source A, destination B
to link layer
 R creates link-layer frame containing A-to-B IP datagram. Frame destination address:
B's MAC address
MAC src: 1A-23-F9-CD-06-9B
MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
Eth
Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-28
Routing to another subnet: addressing
 R determines outgoing interface, passes datagram with IP source A, destination B
to link layer
 R creates link-layer frame containing A-to-B IP datagram. Frame destination address:
B's MAC address
MAC src: 1A-23-F9-CD-06-9B
 transmits link-layer frame MAC dest: 49-BD-D2-C7-56-2A
IP src: 111.111.111.111
IP dest: 222.222.222.222
IP
IP Eth
Eth Phy
Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-29
Routing to another subnet: addressing
 B receives frame, extracts IP datagram destination B
 B passes datagram up protocol stack to IP

IP src: 111.111.111.111
IP dest: 222.222.222.222

IP
IP Eth
Eth Phy
Phy

A B
R
111.111.111.111
74-29-9C-E8-FF-55 222.222.222.222
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
111.111.111.112 111.111.111.110
CC-49-DE-D0-AB-7D E6-E9-00-17-BB-4B 222.222.222.221
88-B2-2F-54-1A-0F
Link Layer: 6-30
Ethernet switch
 Switch is a link-layer device: takes an active role
• store, forward Ethernet frames
• examine incoming frame’s MAC address, selectively forward frame
to one-or-more outgoing links when frame is to be forwarded on
segment, uses CSMA/CD to access segment
 transparent: hosts unaware of presence of switches
 plug-and-play, self-learning
• switches do not need to be configured

Link Layer: 6-31


Switch: multiple simultaneous transmissions
 hosts have dedicated, direct
connection to switch A
 switches buffer packets C’ B
 Ethernet protocol used on each 1 2
6
incoming link, so: 3
5 4
• no collisions; full duplex
• each link is its own collision B’ C
A’
domain A-to-A’ and B-to-B’ can transmit
 switching:
simultaneously, without collisions switch with six
interfaces (1,2,3,4,5,6)

Link Layer: 6-32


Switch: multiple simultaneous transmissions
 hosts have dedicated, direct
connection to switch A
 switches buffer packets C’ B
 Ethernet protocol used on each 1 2
6
incoming link, so: 3
5 4
• no collisions; full duplex
• each link is its own collision B’ C
A’
domain A-to-A’ and B-to-B’ can transmit
 switching:
simultaneously, without collisions switch with six
interfaces (1,2,3,4,5,6)
• but A-to-A’ and C to A’ can not happen
simultaneously
Link Layer: 6-33
Switch forwarding table
Q: how does switch know A’ reachable via
interface 4, B’ reachable via interface 5? A
C’ B
A: each switch has a switch table, each
entry: 1 2
6
 (MAC address of host, interface to reach 3
host, time stamp) 5 4

 looks like a routing table! B’ C


A’
Q: how are entries created, maintained
in switch table?
 something like a routing protocol?
Link Layer: 6-34
Switch: self-learning Source: A
Dest: A’
 switch learns which hosts
A A’
can be reached through A
which interfaces C’ B
• when frame received, switch 1 2
6
“learns” location of sender: 3
5
incoming LAN segment 4

• records sender/location pair B’ C


A’
in switch table
Switch table
MAC addr interface TTL (initially empty)
A 1 60

Link Layer: 6-35


Self-learning, forwarding: example Source: A
Dest: A’

 frame destination, A’, A A’


location unknown: flood A
C’ B
 destination A location
1
known: selectively send 6A A’
2

on just one link 5 4


3

B’ C
A’ A A’

MAC addr interface TTL


A 1 60 switch table
A’ 4 60 (initially empty)

Link Layer: 6-36


Synthesis: a day in the life of a web request
 our journey down the protocol stack is now complete!
• application, transport, network, link
 putting-it-all-together: synthesis!
• goal: identify, review, understand protocols (at all layers) involved in
seemingly simple scenario: requesting www page
• scenario: student attaches laptop to campus network, requests/receives
www.google.com

Link Layer: 6-37


A day in the life: scenario
scenario:
browser DNS server  arriving mobile
Comcast network client attaches
68.80.0.0/13 to network …
 requests web
school network page:
68.80.2.0/24
www.google.com
web page

Sounds
web server Google’s network
simple!
64.233.169.105 64.233.160.0/19

Link Layer: 6-38


A day in the life: connecting to the Internet
DHCP
DHCP
DHCP
UDP
 connecting laptop needs to get its own IP
DHCP IP address, addr of first-hop router, addr of
arriving mobile:
DHCP Eth
Phy DHCP client DNS server: use DHCP
DHCP

 DHCP request encapsulated in UDP,


DHCP DHCP encapsulated in IP, encapsulated in 802.3
DHCP
DHCP
UDP
IP
Ethernet
DHCP Eth
Phy
router has
 Ethernet frame broadcast (dest:
DHCP server FFFFFFFFFFFF) on LAN, received at router
running DHCP server
 Ethernet demuxed to IP demuxed, UDP
demuxed to DHCP
Link Layer: 6-39
A day in the life: connecting to the Internet
DHCP
DHCP UDP  DHCP server formulates DHCP ACK
DHCP IP
Eth arriving mobile: containing client’s IP address, IP address
of first-hop router for client, name & IP
DHCP

DHCP Phy DHCP client


address of DNS server
DHCP
DHCP  encapsulation at DHCP server, frame
forwarded (switch learning) through LAN,
DHCP
UDP
DHCP
IP
DHCP
Eth demultiplexing at client
DHCP Phy
router has
DHCP server  DHCP client receives DHCP ACK reply

Client now has IP address, knows name & addr of DNS


server, IP address of its first-hop router
Link Layer: 6-40
A day in the life… ARP (before DNS, before HTTP)
DNS DNS  before sending HTTP request, need IP address
UDP
of www.google.com: DNS
DNS

ARP IP
DNS
ARP query Eth arriving mobile:
Phy ARP client  DNS query created, encapsulated in UDP,
encapsulated in IP, encapsulated in Eth. To
send frame to router, need MAC address of
router interface: ARP
ARP  ARP query broadcast, received by router, which
Eth
replies with ARP reply giving MAC address of
ARP reply

Phy
router has router interface
ARP server
 client now knows MAC address of first hop
router, so can now send frame containing
DNS query

Link Layer: 6-41


A day in the life… using DNS
DNS
DNS DNS
DNS UDP
DNS DNS  demuxed to DNS
DNS UDP
DNS IP
DNS IP  DNS replies to client
Eth DNS
DNS Phy
DNS Eth
server
with IP address of
Phy
DNS
www.google.com

Comcast network
68.80.0.0/13

 IP datagram
 IP datagram forwarded from campus
containing DNS query
network into Comcast network,
forwarded via LAN
routed (tables created by RIP, OSPF,
switch from client to
IS-IS and/or BGP routing protocols)
1st hop router
to DNS server
Link Layer: 6-42
A day in the life…TCP connection carrying HTTP
HTTP
HTTP  to send HTTP request,
SYNACK
SYN TCP
SYNACK
SYN IP client first opens TCP
SYNACK
SYN Eth
Phy Comcast network
socket to web server
68.80.0.0/13
 TCP SYN segment (step 1 in TCP
3-way handshake) inter-domain
routed to web server
 web server responds with
SYNACK
SYN
SYNACK
SYN
TCP
IP
TCP SYNACK (step 2 in TCP 3-
SYNACK
SYN Eth way handshake)
Phy
Google web server
 TCP connection established!
64.233.169.105

Link Layer: 6-43


A day in the life… HTTP request/reply
HTTP
HTTP
HTTP
HTTP
HTTP
TCP
 HTTP request sent into
HTTP
HTTP IP  web page finally (!!!) TCP socket
HTTP
HTTP Eth displayed
Phy Comcast network  IP datagram containing
68.80.0.0/13
HTTP request routed to
www.google.com
 web server responds with
HTTP
HTTP
HTTP
TCP
HTTP reply (containing web
HTTP
IP page)
HTTP Eth
Phy  IP datagram containing
Google web server HTTP reply routed back to
64.233.169.105
client
Link Layer: 6-44
Chapter 6: Summary
 principles behind data link layer services:
• error detection, correction
• sharing a broadcast channel: multiple access
• link layer addressing
 instantiation, implementation of various link layer technologies
• Ethernet
• switched LANS, VLANs
• virtualized networks as a link layer: MPLS
 synthesis: a day in the life of a web request

Link Layer: 6-45

You might also like