CN Unit-5
CN Unit-5
5 Link
Layer
A note on the use of these ppt slides:
We’re making these slides freely available to all (faculty, students, readers). They’re Computer
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
They obviously represent a lot of work on our part. In return for use, we only ask
the following: Top Down
Approach
❖ If you use these slides (e.g., in a class) that you mention their source
(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 from
(or perhaps identical to) our slides, and note our copyright of this material.
6th edition
Jim Kurose, Keith
Thanks and enjoy! JFK/KWR
Ross Addison-Wesley
March 2012
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Link Layer 5-
Chapter 5: Link
layer
our goals:
❖ understand principles behind link
layer services:
▪ error detection, correction
▪ sharing a broadcast channel: multiple
access
▪ link layer addressing
▪ local area networks: Ethernet, VLANs
❖ instantiation, implementation of
various link layer technologies
❖ system buses
combination of network adapter
card
hardware, software,
firmware
Link Layer 5-8
Adaptors
communicating
datagram datagram
controller controller
frame
otherwise
10.
Division in the CRC receiver for two cases-message without error and with error
10.
Parity
checking
single bit parity: two-dimensional bit parity:
❖ detect single bit ❖ detect and correct single bit errors
errors
0 0
sende receiver
❖ treat segment
r: : compute checksum
❖
contents as sequence of received
of 16-bit integers ❖ segment
❖ checksum: addition check if computed
(1’s complement checksum equals
sum) of segment checksum field value:
❖ contents ▪ N O - error detected
sender puts ▪ YES - no error
checksum value detected. But maybe
into UDP checksum errors nonetheless?
field
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
6-slot 6-slot
frame frame
1 3 4 1 3 4
FDM cable
node 2 2 2 2
node 3 3 3 3
C E C S E C E S S
Pro Cons:
s: single active node can
❖ ❖ collisions, wasting
continuously ❖ slots idle slots
transmit at full rate
❖ of channel
❖ nodes may be able
highly decentralized: to detect collision
only slots in nodes in less than time to
❖ need to be in sync transmit packet
simple ❖ clock
synchronization Link Layer 5-26
Slotted ALOHA:
efficiency
efficiency: long-run ❖ max efficiency: find p*
fraction of successful that maximizes
slots (many nodes, all Np(1-p)N-1
with many frames to ❖ for many nodes, take
send) limit of N p*(1-p*)N-1 as
❖ suppose: N nodes with N goes to infinity,
many frames to send, gives:
each transmits in slot max efficiency = 1/e
with probability p = .37
!
❖ prob that given node at best:
has success in a slot= channel used for
p(1-p)N-1 useful
❖ prob that any node has transmissions
a success = Np(1-p)N-1 37% of time!
Link Layer 5-27
Pure (unslotted)
ALOHA
❖unslotted Aloha: simpler, no
❖ synchronization when frame first arrives
▪transmit immediately
❖ collision probability
increases:
▪ frame sent at t0 collides
with other frames sent in
[t0-1,t0+1]
= p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)
= 1/(2e) = .18
transmission
❖ human analogy: don’t interrupt
others!
collisions
❖collisions can still
occur: propagation
delay means two
nodes may not
hear each
❖ other’s
transmission
collision: entire
packet transmission
time wasted
▪ distance &
propagation delay
play role in in
determining collision
probability
concerns:
▪ polling overhead
▪ latency slaves
▪ single point
of failure
(master)
The polling protocol eliminates the collisions and empty slots that plague
random access protocols. This allows polling to achieve a much higher
efficiency.
The first drawback is that the protocol introduces a polling delay—the amount
of time required to notify a node that it can transmit. If, for example, only
one node is active, then the node will transmit at a rate less than R bps, as the
master node must poll each of the inactive nodes in turn each time the
active node has sent its maximum number of frames.
The second drawback, which is potentially more serious, is that if the master
node fails, the entire channel becomes inoperative.
“Taking turns” MAC
protocols
token
T
passing:
❖ control token
passed from one
node to next
❖ sequentially.
(nothing
❖ token to send)
message T
concerns:
▪ token
overhead
▪ latency
▪ single point of
failure (token) data
Link Layer 5-39
Token Passing (Cont..)
Disadvantages
For example, the failure of one node can crash the entire channel.
if a node accidentally neglects to release the token, then some
recovery procedure must be invoked to get the token back
in circulation
C able access
network Internet frames,TV channels, control transmitted
downstream at different frequencies
cable headend
CMTS
…
splitter cable
cable modem … modem
termination system
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 src: 111.11IP1.1d1e1s.t:112122.222.222.222
IP dest: 222.222.222.222
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
I
P
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
10 Gbps
switch
star
bus: coaxial cable
Link Layer 5-58
Ethernet frame
structure
sending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet
frame
dest. source type
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-BX
physical 100BASE-T4 100BASE-SX
entry: B C
’
▪ (MAC address of host,
interface to reach host, A’
time are
Q: how stamp)
entries switch with six interfaces
created, maintained
▪ looks like a routing table! (1,2,3,4,5,6)
in switch table?
▪ something like a
routing protocol? Link Layer 5-66
Switch: self- Source: A
Dest: A’
learning
❖ switch learns which A A A’
hosts can be reached
C B
through which
’
interfaces 1
6 2
▪ when frame received,
switch “learns” 5 4 3
location of sender:
incoming LAN B C
segment ’
▪ records
A’
sender/location pair
in switch table MAC addr interface TTL
A 1 60 Switch table
(initially empty)
example A A A’
❖ frame destination, A’,
B
locaton unknown: C
’
flood 6 1 2
❖ destination A A A’
5 4 3
location known: B C
’
selectively send A’
A
on just one link
A’
MAC addr interface TTL
A 1 60 switch table
A’ 4 60 (initially empty)
together S4
S1
S3
A S2
F
D I
B C
G H
E
S1
S3
A S2
F
D I
B C
G H
E
IP subnet
switch(es) supporting
VLAN capabilities can … …
be configured to define Electrical Engineering Computer Science
multiple virtual LANS (VLAN ports 1-8) (VLAN ports 9-15)
… …
switch port 2 8 10 16
❖ dynamic membership:
ports can be dynamically … …
assigned among VLAN s Electrical Engineering Computer Science
(VLAN ports 1-8) (VLAN ports 9-15)
❖ forwarding between VLANS:
done via routing (just as with
separate switches)
▪ in practice vendors sell
combined switches plus
routers
Link Layer 5-76
VLANS spanning multiple
switches
1 7 9 15 1 3 5 7
2 8 10 16 2 4 6 8
… …
type
Label-
label Exp S TTL
20 3 1 5
Link Layer 5-80
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)
A
R2
RSVP-TE
R6
D
R4
R5 modified
link state A
flooding
interface
10 A 0
in out out
12 D 0 label label dest
in te rf e
8 A 1 1 0 6
ac A 1
12 9 0
D
R6
0 0
D
1 1
R4 R3
R5
0 0
A
R2 in
out
out
in out out label labelR dest
label label dest int erface A
int erfa e
8 6 6 -
c
A 0 0
Link Layer 5-85
MPLS(Cont..)
Tier-1 switches
B
A C Tier-2 switches
TOR
switches
Server racks
1 2 3 4 5 6 7 8
Link Layer 5-85
Data center
networks
❖ rich interconnection among switches, racks:
Tier-1 switches
Tier-2 switches
TOR
switches
Server racks
5 6 7 8
1 2 3 4
Link layer, LAN s:
outline
1. introduction, 5. link
services virtualization:
2. error detection, MPLS
correction 6. data
3. multiple center
access networking
protocols 7. a day in the life
4. LANs of a web request
▪ addressing,
ARP
▪ Ethernet
▪ switches
▪ VLANS Link Layer 5-91
Synthesis: a day in the life of a web
request
❖ journey down protocol stack 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
school network
68.80.2.0/24
web page
router
❖ IP datagram forwarded from
(runs DHCP) campus network into comcast
❖ IP datagram containing network, routed (tables
D N S query forwarded via created by RIP, OSPF, IS-IS
LAN switch from client and/or BGP routing protocols)
to 1st hop router ❖ to DNS server
❖ demux’ed to D N S server
D N S server replies to
client with IP addressLink
ofLayer 5-97
www.google.com
A day in the life…TCP connection carrying
HTTP
HTTP
HTTP
SYSNYANCK TCP
SYSNYA IP
NCK
SYSNYA Eth
NCK
Phy
❖ to send HTTP
client first opens TCP
request,
socket
router ❖ to web server
(runs DHCP)
SYSNYANCK TCP TC P SYN segment (step 1 in
SYSNYANCK IP 3- way handshake) inter-
SYSNYA
Eth domain routed to web
NCK
Phy ❖ web server responds with
server
TCP SYNACK (step 2 in 3-
web server way handshake)
64.233.169.105 ❖ TCP connection established!