Professional Documents
Culture Documents
VSJ-link Layer LAN
VSJ-link Layer LAN
Network Network
Layer Layer Datagram
Data Link Data Link
Layer Layer Frame
Physical Physical
Electrical and
Layer Layer
Optical signals
Hop-by-Hop Transport
Argon argon.tcpip-lab.e du
"Argon"
ne on.tcpip-lab.e du
"Neon"
Neon
128.143.137.144 128.143.71.21
Router
M
application
Ht M transport
Hn Ht M network data link network
protocol
Hl Hn Ht M link link Hl Hn Ht M
adapter card
Link Layer Services Parallels transport layer
services
Framing, link access:
encapsulate datagram into frame, adding header, trailer
implement channel access if shared medium,
‘physical addresses’ used in frame headers to identify source,
destination
• different from IP address! Catch the error on the link
where it occurs
Reliable delivery between two physically connected
devices:
we learned how to do this already (chapter 3)! Mechanisms:
Seq.Nos, Timers,
seldom used on low bit error link (fiber, some twisted pair) ACKs
wireless links: high error rates
• Q: why both link-level and end-end reliability?
Link Layer Services (more)
Flow Control:
pacing between sender and receivers
Error Detection: More sophisticated; hardware-implemented
errors caused by signal attenuation & electromagnetic
noise.
Sender sets error-detection bits in the frame; receiver
detects presence of errors:
• signals sender for retransmission or drops frame
Error Correction:
receiver identifies and corrects bit error(s) without
resorting to retransmission
Where is the link layer implemented?
In Each And Every Host
Link Layer Implemented In
“ Adaptor” (Network
Interface Card NIC) Or On
A Chip application
transport
cpu memory
network
Ethernet Card, 802.11 link
datagram datagram
controller controller
frame
otherwise
0 0
sender: receiver:
treat segment contents as compute checksum of
sequence of 16-bit received segment
integers check if computed
checksum: addition (1’s checksum equals checksum
complement sum) of field value:
segment contents NO - error detected
sender puts checksum YES - no error detected.
value into UDP But maybe errors
checksum field nonetheless?
want:
D.2r XOR R = nG
equivalently:
D.2r = nG XOR R
equivalently:
if we divide D.2r by Modulo-2 arithmetic
without carries in
G, want remainder R addition or borrows in
to satisfy: subtraction
D.2r
R = remainder[ ]
G
5-18
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
6-slot 6-slot
frame frame
1 3 4 1 3 4
time
frequency bands
FDM cable
node 2 2 2 2
node 3 3 3 3
C E C S E C E S S
Pros: Cons:
single active node can collisions, wasting slots
continuously transmit at idle slots
full rate of channel nodes may be able to
highly decentralized: only detect collision in less
slots in nodes need to be
in sync than time to transmit
packet
simple clock synchronization
Link Layer 5-26
Slotted ALOHA: efficiency
!
prob that given node has
success in a slot = p(1- used for useful
p)N-1 transmissions 37%
prob that any node has a of time!
success = Np(1-p)N-1
Link Layer 5-27
Derivation of the efficiency of slotted ALOHA.
a. Recall that when there are N active nodes, the efficiency of slotted ALOHA
is Np(1 – p) N–1. Find the value of p that maximizes this expression.
b. Using the value of p found in (a), find the efficiency of slotted ALOHA by
letting N approach infinity. Hint: (1 – 1/N) N approaches 1/e as N approaches infinity.
Solution:
a. The efficiency of slotted ALOHA is
E(p) = 𝑁𝑝(1 − 𝑝)𝑁−1
By derivation, we have
E ′ (p) = N(1 − p)N−1 − 𝑁𝑝(𝑁 − 1)(1 − 𝑝)𝑁−2 = 𝑁(1 − 𝑝)𝑁−2 ((1 − 𝑝) − 𝑝(𝑁 − 1))
Let
E ′ (p) = 0
Thus, when
p∗ = 1/𝑁, We have the maximum efficiency.
b. When p equals to 1/N , the efficiency of slotted ALOHA is
E(p∗) = 𝑁*1/𝑁(1 − 1/𝑁 )𝑁−1 = (1 − 1/𝑁 )𝑁−1 = (1 − 1 𝑁 )𝑁 / 1 − 1/N
Since
lim N→∞ (1 − 1/𝑁 ) = 1
then lim N→∞ (1 − 1/𝑁 )𝑁 = 1/𝑒
Thus when n approaching infinity, the efficiency is
lim N→∞ 𝐸(𝑝∗) = 1/𝑒
= p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)
= 1/(2e) = .18
efficiency goes to 1
as tprop goes to 0
as ttrans goes to infinity
better performance than ALOHA: and simple, cheap, decentralized ! 1
efficiency
1 5t prop /ttrans
data
Link Layer 5-39
Summary of MAC protocols
channel partitioning, by time, frequency or code
Time Division, Frequency Division
random access (dynamic),
ALOHA, S-ALOHA, CSMA, CSMA/CD
carrier sensing: easy in some technologies (wire), hard
in others (wireless)
CSMA/CD used in Ethernet
CSMA/CA used in 802.11 (Collision Avoidance)
taking turns
polling from central site, token passing
bluetooth, FDDI, token ring
1A-2F-BB-76-09-AD
LAN
(wired or adapter
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP
Eth
Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP IP
Eth Eth
Phy Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
IP
Eth
Phy
A B
R
111.111.111.111
222.222.222.222
74-29-9C-E8-FF-55
49-BD-D2-C7-56-2A
222.222.222.220
1A-23-F9-CD-06-9B
switch
star
bus: coaxial cable
Link Layer 5-55
Ethernet frame structure
sending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
type
dest. source
preamble address address data CRC
(payload)
preamble:
7 bytes with pattern 10101010 followed by one
byte with pattern 10101011
used to synchronize receiver, sender clock rates
MAC protocol
application and frame format
transport
network 100BASE-TX 100BASE-T2 100BASE-FX
link 100BASE-T4 100BASE-SX 100BASE-BX
physical
A A A’
switch learns which hosts
can be reached through B
C’
which interfaces
when frame received, 6 1 2
switch “ learns”
location of sender: 5 4 3
incoming LAN segment
records sender/location B’ C
pair in switch table
A’
A A A’
frame destination, A’,
B
location unknown: flood C’
1
destination A location 6 2
selectively send
known:
on just one link
A A’
5 4 3
B’ C
A’ A
A’
S1
S3
A S2
F
D I
B C
G H
E
S4
S1
S3
A S2
F
B C D I
G H
E
IP subnet
switch(es) supporting
VLAN capabilities can … …
be configured to Electrical Engineering Computer Science
define multiple virtual (VLAN ports 1-8) (VLAN ports 9-15)
… …
2 8 10 16
2 8 10 16 2 4 6 8
… …
type
PPP or Ethernet
MPLS header IP header remainder of link-layer frame
header
20 3 1 5
QoS priority (experimental) and Explicit Congestion bottom of stack Link Layer 5-77
MPLS capable routers
a.k.a. label-switched router
forward packets to outgoing interface based only on
label value (don’t inspect IP address)
MPLS forwarding table distinct from IP forwarding tables
flexibility: MPLS forwarding decisions can differ
from those of IP
use destination and source addresses to route flows to same
destination differently (traffic engineering)
re-route flows quickly if link fails: pre-computed backup
paths (useful for VoIP)
R6
D
R4 R3
R5
A
R2
RSVP-TE
R6
D
R4
R5 modified
link state A
flooding
R6
0 0
D
1 1
R4 R3
R5
0 0
A
R2 in outR1 out
label label dest
in out out
interface
label label dest 6 - A 0
interface
8 6 A 0
Link Layer 5-82
Link layer, LANs: outline
5.1 introduction, services 5.5 link virtualization:
5.2 error detection, MPLS
correction 5.6 data center networking
5.3 multiple access 5.7 a day in the life of a
protocols web request
5.4 LANs
addressing, ARP
Ethernet
switches
VLANS
challenges:
multiple applications, each serving
massive numbers of clients
managing/balancing load, avoiding
processing, networking, data
bottlenecks
Tier-1 switches
B
A C Tier-2 switches
Server racks
1 2 3 4 5 6 7 8
Link Layer 5-85
Data center networks
rich interconnection among switches, racks:
increased throughput between racks (multiple routing paths possible)
increased reliability via redundancy
Tier-1 switches
Tier-2 switches
TOR
switches
Server racks
1 2 3 4 5 6 7 8
Link layer, LANs: outline
5.1 introduction, services 5.5 link virtualization:
5.2 error detection, MPLS
correction 5.6 data center networking
5.3 multiple access 5.7 a day in the life of a
protocols web request
5.4 LANs
addressing, ARP
Ethernet
switches
VLANS
school network
68.80.2.0/24
web page
router
ARP query broadcast, received by
(runs DHCP) router, which replies with ARP
reply giving MAC address of
router interface
client now knows MAC address
of first hop router, so can now
send frame containing DNS
query
Link Layer 5-92
A day in the life… using DNS DNS
DNS UDP DNS server
DNS IP
DNS DNS DNS Eth
DNS UDP DNS Phy
DNS IP
DNS Eth
Phy
DNS
Comcast network
68.80.0.0/13
router
IP datagram forwarded from
(runs DHCP) campus network into comcast
IP datagram containing DNS network, routed (tables created by
query forwarded via LAN RIP, OSPF, IS-IS and/or BGP
switch from client to 1st hop routing protocols) to DNS server
router demux’ed to DNS server
DNS server replies to client
with IP address of
www.google.com
Link Layer 5-93
A day in the life…TCP connection carrying HTTP
HTTP
HTTP
SYNACK
SYN TCP
SYNACK
SYN IP
SYNACK
SYN Eth
Phy