Transcript Link Layer

Data Link Layer
Introduction to DLL
Application


Transport
Receives service from physical layer and
provides service to the network layer. Network
Data Link
Two models
 Internet





model and IEEE model
Physical
Responsible for carrying data from one hop to
the next hop.
Media access
Data Link
Packet integrity.
control(MAC)
Logical Link
layer
control
Flow control.
Physical
Physical
Layer
Layer
Access control.
Transmission medium
Examples of LL protocol
IEEE
Internet
 Ethernet,
token ring, FDDI, ATM
Services Provided by LL

Framing and Link access –
 frame
has data filed+header; NL datagram is placed
in data field, header includes physical address. Pointto-point, shared

Reliable delivery
 Acknowledgement

Flow control
 Prevents

and transmission
from loosing pkts
Error detection & detection
 Detection
is implemented in HW, ATM provides
correction of Header field only.

Half-duplex & Full-duplex
Error detection and correction

Parity checks


Checksumming


2-D Single bit
Internet CS 16 bit integers
Cyclic Redundancy Check
1 01 0 1 1
1 01 0 1 1
1 111 0 0
0 111 0 1
0 01 0 1 0
1 011 0 0
0 111 0 1
0 01 0 1 0

Generator G is r+1 bit pattern
with msb 1; 1001 if r=3.
 For a given d-bit data, D,
sender will choose r additional
bits, R, and append them to D
such that resulting d+r bit
pattern is exactly divisible by
G using modulo 2 arithmetic.
 All CRC calculation are done
mod 2 arithmatic without
carries or borrows. This is
identical to XOR operation.
d bits
D: data bits to be sent
D*2r XOR R
r bits
R:CRC
Example
1010 xor 1001=0011
R is such that ther e is an n
D.2 r  R  nG
we want to choose R such that G divides D.2  R without reminder.
If we xor both side by R then,
Again,
r
D.2 r  nG  R ...... (1)
we can calculate R as
D.2 r
R  reminder of
G
Let D = 101110, d=6 and G =1001, r = 3. The nine bits
transmitted here is 101110 011. D.2r = 101110000.
0011 xor 1001=1010
Medium access control

Network links:


Point – to – point: PPP and HDLC
Broadcast – Ethernet


MA protocol category




Multiple access problem
Channel partitioning
Random access
Taking turn
A MA protocol for a broadcast channel of rate R bps sud have
the following charac:




When one node is active, throughput is R bps.
For M nodes, each has avrg R/M bps over some suitable interval of
time.
Decentralized, no master node.
Simple and inexpensive.
Channel partitioning

TDM




FDM


Time frame, N time slots.
Perfectly fair, avoids
collisions.
Poor BW utilization.
Avoids collisions but poor
BW utilization.
CDMA




CDMA code, orthogonal
Chip rate is much faster
than transmission rate.
Encoding, Zi,m=di.cm
Decoding,
M
1
M
Z
m 1
i ,m
.cm
Random Access

When there is a collision a sender waits
for random length of time and retransmits
the frame
 Aloha:
slotted, unslotted (pure)
Pure ALOHA efficiency 1/2e =0.184.
 Slotted efficiency max. = 0.368

 CSMA
– ethernet.
ALOHA


Fully decentrlized.
When a frame first arrives, the
node immediately transmits the
entire frame. If the frame
experiences a collision with
one or more frames, it then
immediately retransmits the
frame with probability p.
Otherwise, the node waits for a
frame time. After this wait the
node retransmits the frame
with probability p, or waits for
another frame time with
probability 1-p.
Node
Will overlap
with start of i’s
frame
(1  p) N 1
to- 1
to
i
Will overlap
with end of
i’s frame
to +1
probability that only one node put frame at time t0 =
(1  p ) N 1
Thus the probability that given node
is successful is
p(1  p )2( N 1)
Pure ALOHA










Let users transmit whenever they have data to
be sent.
If two packets collide in the medium, both will
retransmit their packet after a random delay
What is the efficiency of pure ALOHA.?
Infinite users.
t = frame time.
t0
t0+t
t0+2t
new frames generated per t according to
Poisson distribution with mean N frames. If N>1
x N
N
e
there will be collision for almost every frame. So,
Pr[ x ] 
x!
0<N<1.
Let, k transmission attempts including new and
k G
G
e
retransm packet are done per t with mean G
Pr[ k ] 
frames/t.
k!
For low load N≈0, few collision, therefore, G≈N.
At high load GN.
Probability of zero frame is generated per frame
time, Pr[0] = P0 = e-G.
t0+3t





Under all load, throughput S =
GP0, where P0 is the success
probability of a frame.
Collision occurs if a frame is
transmitted within t0 to t0+t or
within t+t0 to t+2t0; i.e collision
occurs in 2 frame times long
with mean 2G.
No other frame is generated
within 2 frame time is P0= e-2G.
Throughput S = Ge-2G.
At G=0.5, S = 1/2e = 0.184.
that is best channel utilization
is 18.4%.
Slotted ALOHA
When the node has a new frame, it waits
until the beginning of the next slot and
transmit the entire frame in the slot.
 If there isn’t a collision, the node has
successful transmission.
 If there is a collision, the node detects the
collision before the end of the slot. The
node retransmit its frame in each
subsequent slot with probability p until the
frame is successfully transmitted.

1
1
2
2
1
2
3
C




1
3
E
C
S
E
C
3
E
S
S
collision period is t, i.e. one frame time. Therefore, probability that
no other traffic is sent during the same slot time is, e-G. So,
throughput = Ge-G.
At G=1, S = 0.368.
If the probability that a frame avoid collision is e-G. then probability
that it suffers a collision is 1-e-G. then probability that k attempts
require for a successful transmission is Pk  e G (1  e G )k 1
Expected number of transmissions per frame time,


k 1
k 1
E   kPk   keG (1  e G )k 1  eG
Carrier sense multiple access
Listen before talk.
 No detection.
 Non-persistent.
 Persistent.

1
persistent
 p persistent
Wait random
time…
Sense carrier
Busy?
no
yes
Send the frame
Sense carrier
Sense carrier
Busy?
no
Send the frame
with probability 1
Non-persistent
yes
Busy?
no
yes
Send the frame
with probability p
persistent
CSMA

Persistent
 1 persistent: Stations continually checks the channel. If the
channel is free sends frame instantly.
the longer the propagation delay the worse the performance of the
protocol.
 Even when the delay is 0, collision can be happed. If two stations
become ready in the middle of the transmission of a third one, both
with start transmitting as soon as they find the channel empty after
the 3rd stations transmission is over.
 p- persistent: when a station is has data to send, it senses the channel.
If it is idle, it transmits with probability p. otherwise it defers to the next
slot with probability q = 1-p. the process repeat until either the frame
has been transmitted or another station has begun transmission.


Nonpersistent
 If the channel is busy the station does not continually check it for
detecting the end of ongoing transmission. It waits for a random
time then checks the channel. If the channel is idle, sends the
frame.
CSMA/CD



First listen, if the line is busy, backoff.
If collision occurs, abort the transmission.
waits a random period of time, and then tries
A
B
C
D
again.
t0

Why collision.
t
t1
CSMA/CD Flowchart
start
• Exponential backoff, e.g 2Nx max_prop_time.
Wait backoff
time
Set backoff
To zero
Persistent
strategy
Send the frame
no
Backoff
Limit?
yes
abort
Increment Send jam yes
Collision?
backoff
signal
no
success
start
CSMA/CA

Set backoff
To zero
Persistent
strategy
Used in
wireless LAN.
Wait IFG time
Wait backoff
time
Wait a
random time
Send the frame
Set a timer
no
Backoff
Limit?
yes
abort
Increment no ACk recvd
before timeout?
backoff
yes
success
Controlled access
Reservation
 Polling.

Token passing

Token ring
 Wait
for a token
 Captures the token.
 If it has data frame to send, then send it.
 If allocated time is expired, remove the token,
else send more frames.

FDDI
 The
same as token ring, but token is removed
by the destination.
LAN
Local Area Networks, one broadcast
channel.
 LAN address or Physical Address, 48 bits,
unique.
 IEEE manages LAN address. Assigns MS
24 bits.
 Most dominant technology is Ethernet.

Address Resolution Protocol
A table that resolves LAN address to IP.
 ARP frame is broadcasted (LAN add FFFF-FF-FF) to get the LAN address of a
particular computer with a given IP.

IP
LAN Add
TTL
111.111.111
F0-23-A7-B0-00-3C 20
LAN operation
FF-2C-CC-FF-AD-03
111.111.111.110
222.222.222.113
FF-2C-CC-00-0D-01
111.111.111.111
FF-2C-CC-00-0D-02
111.111.111.112
FF-2C-CC-A2-0D-03
111.111.111.115
FF-2C-CC-00-0D-03
111.111.111.113
FF-2C-CC-00-0D-04
111.111.111.114
FF-2C-CC-FF-0D-03
222.222.222.110
FF-2C-CC-00-0D-05
Routing table
ARP query packt uses LAN broadcast address
Ethernet


Ethernet was developed in 1976 at Xerox's Palo Alto Research Center.
Data Link Layer



LAN topology



Bus or star
MAC sublayer


Logical Link control sublayer.
Machine Access Control sublayer.
Governs the access method.
Access method: traditional Ethernet uses 1-persistent CSMA/CD.
Ethernet Frame





Preamble (7 bytes).- alternating 0, 1
Start Field delimiter (1). - 10101011
Destination Address (6).
Source Address (6).
Length/type of protocol data unit (PDU) (2). For <1518 it defines the length. If
>1536 it defines type
 Data and padding (min 64, max 1500) .
 CRC (4).
Ethernet frame Length
Min frame length is 64 bytes, required for
correct operation of CSMA/CD.
 Max. frame length is 1518 bytes.
 Ethernet provided unreliable connectionless service: no handshaking, no ackn.

Ethernet Address
Embeded into the Network Interface Card
(NIC).
 6-bytes.
 Expressed in hex notation.e.g. 06-01-0201-2C-4B.
 Unicast or multicast

 LSB
of the first byte 0: unicast.
 LSB of the first byte 1: multicast.
Physical Layer Signaling



Uses Manchester
encoding.
Includes a transition
in the middle of each
bit.
Helps synchronize
sender and recvr.
From
MAC
To
MAC
Manchester
encoder
Manchester
Decoder
To
transceiver
From
transceiver
Ethernet CSMA/CD operation




Adapter obtains a network-layer PDU from its parent node,
prepares an ethernet frame, and puts the frame in the adapter
buffer.
If the adapter senses that the channel is idle (i.e. der is no
signal energy from other channel), it starts to transmit the
frame. If the adapter senses that the channel is busy, it waits
until it senses no signal energy plus 96 bits time and then
transmits the frame.
While transmitting, the adapter monitors for the presence of
signal energy from other apaters. If the adapter finds some
signal energy from other sources before completing its
transmission, it aborts instantly and sends a 48 bit jam signal.
After aborting, the adapter enters into a backoff phase.
Specifically, when transmitting a given frame, after
experiencing the n collision in for this frame, the adapter
chooses a value for K at random from {0,1,2, . . ., 2m-1} where
m:= min(n,10).i The adapter then waits K.512 bit times and
then returns to step to.
Efficiency


Efficiency drops when number of nodes
increases.
Let tprop denote the max prop delay, ttran be the
time to transmit maximum size ethernet frame
(approx 1.2 ms for 10Mbps). The efficiency,

1
1  5t prop / ttrans
Ethernet technologies

10Base2
 Coaxial
cable, bus topology, 10 Mbps
 Max node distance is 200m (actually 185m)

10BaseT
 Twisted
pair copper wire, star topology, 10Mbps. Max
length betwn two nodes=200m

100BaseT
 Category

-5 cable, use4B5B encoding
Gigabit Ethernet
 Both
fiber and twisted-pair
Hubs
Multi-tier, stacked hub connections
 LAN segment
 Collision domain.
 Restrictions on max. number of nodes in a
collision domain, max distance between
two nodes, max number of stacking

Bridge







Division of LAN by Bridge.
Raises Bandwidth.
Separate collision domain.
Bridge filtering and forwarding is done by bridge
table.
Performs CSMA/CD.
No theoretical limit on the geographical reach.
Bridge may connect Wireless LAN with Ethernet.
Switched Ethernet
It is like multiport high performance bridge.
Makes N separate collision domain .
 Usually bridges have small number of
interfaces (2-4), but switches have
dozens.

Spanning tree bridges

Data Communication and Networking
by Behrouz A. Forouzan