Data Link Layer. Introduction to DLL Receives service from physical layer and provides service to...

36
Data Link Layer

Transcript of Data Link Layer. Introduction to DLL Receives service from physical layer and provides service to...

Data Link Layer

Introduction to DLL

Receives service from physical layer and provides service to the network layer.

Two models Internet model and IEEE model

Responsible for carrying data from one hop to the next hop.

Packet integrity. Flow control. Access control. Examples of LL protocol

Ethernet, token ring, FDDI, ATM

Application

Transport

Network

Data Link

Physical

Media access control(MAC)Logical Link

controlPhysical

Layer

Data Linklayer

PhysicalLayer

Transmission medium

IEEE Internet

Services Provided by LL Framing and Link access –

frame has data filed+header; NL datagram is placed in data field, header includes physical address. Point-to-point, shared

Reliable delivery Acknowledgement and transmission

Flow control Prevents 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

2-D Single bit Checksumming

Internet CS 16 bit integers Cyclic Redundancy Check

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.

0

1

0

1

1

0

0

1

0

1

1

0

1

1

1

1

0

1

1

0

0

0

1

1

0

1

0

1

1

0

0

1

0

1

1

0

1

1

1

1

0

1

0

0

0

0

1

1

D: data bits to be sent R:CRC

d bits r bits

D*2r XOR R

Example

G

DR

RnGD

RD

nGRD

nR

r

r

r

r

2.ofreminder

as Rcalculate can we

(1) ...... 2.

then,by R side bothxor weIf

reminder. without 2. divides G that such Rchoose want towe

2.

an is e that thersuch is

1010 xor 1001=0011

Again,

0011 xor 1001=1010

Let D = 101110, d=6 and G =1001, r = 3. The nine bits transmitted here is 101110 011. D.2r = 101110000.

Medium access control Network links:

Point – to – point: PPP and HDLC Broadcast – Ethernet

Multiple access problem MA protocol category

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

Time frame, N time slots. Perfectly fair, avoids

collisions. Poor BW utilization.

FDM 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

mmmi cZ

M 1, .

1

Random Access When there is a collision a sender waits

for random length of time and retransmits the frameAloha: 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.

1)1( Np

Node i

to- 1 to to +1

Will overlap with start of i’s frame

Will overlap with end of i’s frame

1)1( Np

Thus the probability that given node is successful is

)1(2)1( Npp

probability that only one node put frame at time t0 =

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. new frames generated per t according to

Poisson distribution with mean N frames. If N>1 there will be collision for almost every frame. So, 0<N<1.

Let, k transmission attempts including new and retransm packet are done per t with mean G frames/t.

For low load N≈0, few collision, therefore, G≈N. At high load GN. Probability of zero frame is generated per frame

time, Pr[0] = P0 = e-G.

t0 t0+t t0+2t t0+3t

!]Pr[

x

eNx

Nx

!]Pr[

k

eGk

Gk

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.

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

Expected number of transmissions per frame time,

1)1( kGGk eeP

C E C S E C S SE

1

2

3

1

2 2

1

3

1

3

1

1

1

)1(k

GkGG

kk eekekPE

Carrier sense multiple access

Listen before talk. No detection. Non-persistent. Persistent.

1 persistentp persistent

Sense carrier

Send the frame

Wait random time…

Busy?yes

no

Sense carrier

Send the frame with probability p

Busy?yes

no

Non-persistent

persistent

Sense carrier

Send the frame with probability 1

Busy?yes

no

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

again.

Why collision.

A B C D

t0 t1

t

CSMA/CD Flowchart

start

Set backoffTo zero

Persistentstrategy

Send the frame

Collision?

success

Send jamsignal

Incrementbackoff

BackoffLimit?

Wait backofftime

abortno

yesno

yes

• Exponential backoff, e.g 2Nx max_prop_time.

CSMA/CA

Used in wireless LAN.

Persistentstrategy

Wait IFG time

Wait arandom time

Send the frame

Set a timer

Wait backofftime

Incrementbackoff

ACk recvdbefore timeout?

BackoffLimit?

abort success

start

Set backoffTo zero

yesyes

no

no

Controlled access

Reservation Polling.

Token passing Token ring

Wait for a tokenCaptures 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 FF-

FF-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

111.111.111.110FF-2C-CC-00-0D-01

FF-2C-CC-00-0D-02

FF-2C-CC-00-0D-03

FF-2C-CC-00-0D-04

FF-2C-CC-00-0D-05

111.111.111.111

111.111.111.112

111.111.111.113

111.111.111.114

FF-2C-CC-A2-0D-03

111.111.111.115

FF-2C-CC-FF-0D-03

222.222.222.110

FF-2C-CC-FF-AD-03

222.222.222.113

ARP query packt uses LAN broadcast address

Routing table

Ethernet Ethernet was developed in 1976 at Xerox's Palo Alto Research Center. Data Link Layer

Logical Link control sublayer. Machine Access Control sublayer.

LAN topology Bus or star

MAC 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 connection-

less service: no handshaking, no ackn.

Ethernet Address

Embeded into the Network Interface Card (NIC).

6-bytes. Expressed in hex notation.e.g. 06-01-02-

01-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.

Manchesterencoder

ManchesterDecoder

From MAC

To MAC

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,

transprop tt /51

1

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 Networkingby Behrouz A. Forouzan