You are on page 1of 38

Lecture 8:

Datalink layer
HEDSPI Project
Hanoi University of Technology
by
Ngo Hong Son

1
Overview
 Last weeks : Application layer
 Model: client-server vs. P2P
 Case study: HTTP, Mail, FTP…
 Today: Datalink layer
 LAN technologies
 Services of datalink layer:  Ethernet
 Framing and addressing  Wireless LAN
 Error detection and correction  WAN technologies
 Flow control  Frame relay
 ATM
 Media access control
 ….

2
Introduction of Data-link layer

3
Nodes and links
“link”
 Nodes:
 PCs, Laptop, Routers,
Server…
 Links:
 Communication channels
between adjacent nodes
 Wired links: Ethernet LAN,
ADSL, fiber optic…
 Wireless Link: Wi-fi, Wi-
Max
 Data-link layer: Dealing the
communication between
adjacent nodes

4
Data-link layer
in OSI model
Application Media independent
sub-layer
Transport

Network LLC
(Logical Link Control)
Data-link
MAC
Physical (Media Access Control) Media dependent
sub-layer

802.2 LLC

802.3 802.4 802.5 802.11 ….. 802.16


Ethernet Token Bus Token Ring Wi-Fi Wi-Max
5
IEEE 802.x series
Overview of Datalink services

Framing Flow control

Media Access Control

Addressing Error control

Datalink layer

6
Services of Data link (1)
 Framing:
 At sender side: encapsulate datagram into frame,
adding header, trailer
 At receiver side: remove header, trailer, take
datagram and pass to upper layer
 Addressing:
 Physical addresses used in frame headers to
identify source & destination

7
Services of Datalink (2)
 Media access control:
 Channel access if the medium is shared, e.g. LAN
with bus topology, Wireless LAN,..
 Flow control:
 Restrict the data rate that sender can send so that
sender does not overwhelm receiver
 Error control:
 Detect and correct bit errors
 e.g. parity check, checksum, CRC check
8
Error control
Error detection
Error detection and correction

9
Principle of error detection
EDC= Error Detection Code (redundancy)

Data Data
Y
All bit in Error
Data’ OK?
N

Data EDC Data’ EDC’

Link with bit errors

10
Parity check
 Single parity check
 Detect only single bit error

 Two Dimensional Bit Parity


 Detect and correct single bit error

 Do you remember Internet


checksum?
11
CRC: Cyclic Redundancy Check

 Data is view as a binary number: D


 Select a r+1 bit pattern, G, so called generator
 Find a r bit binary number R, so that
 <D, R> divisible by G

D D
Y
N
<D’, R’> mod G = 0 ?
<D, R> mod G = 0

D R D’ R’

12
Link with bit errors
CRC: How to compute R

 <D, R> can be re-write in math.  Example


formula D.2r XOR R 10101001000 1001
 <D, R> divisible by G 1001 1011110
1110
 D.2r XOR R = n.G 1001
 So: D.2r = n.G XOR R 1110
 That means R is the remainder 1001
1111
when D.2r divided by G
1001
1100
R= D.2r mod G 1001
1010
1001
110
R=110, so the bits sent are
101010011110

13
CRC in terms of polynomials
 1011 : x3 +x +1
 In reality, some following patterns are used:
 CRC-8 = x8 + x2 + x + 1
 CRC-12 = x12+x11+x3+x2+x
 CRC-16-CCITT = x16 + x12 + x5 + 1
 CRC-32 = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 +
x4 + x2 + x + 1
 The longer G, the more powerful CRC
 CRC is very effective and is used widely
 Wi-fi, ATM, Ethernet…
 can detect all burst errors less than r+1 bits
 Modulo 2 operator are implemented by hardware

14
Media Access Control

15
Type of links
 Point-to-point
 ASDL
 Telephone modem
 ….
 Broadcast
 Traditional LAN with bus topology
 Wireless LAN
 HFC:
 …
 Broadcast channel need a complex protocol to
control the access of multiples users
16
Multiple access protocol
classification
 Channel Division:
 Divide channel into smaller “pieces” (time slots - TDMA,
frequency - FDMA, code - CDMA)
 allocate piece to node for exclusive use
 Random Access:
 channel not divided, allow collisions (contention)
 mechanisms for detect or avoid collisions
 e.g. Pure Aloha, Slotted Aloha, CSMA/CD, CSMA/CA…
 Taking turn:
 Round robin manner
 Token Ring, Token Bus….
17
Channel Division
 FDMA: frequency division multiple access
 TDMA: time division multiple access
 CDMA: code division multiple access

18
Example:
TDMA and FDMA 4 hosts
FDMA

frequency

time
TDMA:

frequency

time 19
CSMA/CD
 Carrier Sense Multiple Access with Collision
Detection
 Human analogy: at a meeting:
 Multiple Access: Many people want to talk
 Collision: At least two people speak at the same
time
 CSMA: “Listen before talk”
 CD: If two people speak at the same time, then
both should stop (they are all polite)
 “Listen while talking”
20
CSMA/CD

 CSMA: Hosts listen before transmit:


 If channel sensed idle: transmit entire frame
 If channel sensed busy, stop transmitting
 So why there are still collisions?
 Main reason: propagation delay

21
CSMA collisions
 Assume there are 4 nodes
with 1 channel
 Electrical signal need
some delay to propagate
from 1 node to other
 e.g. at time t1, D does not
know about transmission
from B at start to transmit
-> Collision

22
CSMA/CD: Summary
 Host listen to channel before transmit
 Busy: Continue to listen
 Idle: Start transmission, but keep listening to the
channel for a short time (to detect collision)
 If there are collision: cancel transmission and
come back to listen state.
 Some variant of CSMA
 Persistent CSMA
 Non-persistent CSMA
 P-persistent CSMA
23
Random Access and Channel
Division: Pros & Cons.
 Channel Division
 Efficient and Fair for links with high load
 Wasted if one allocated channel with high speed
is used by only one node.
 Random Access
 Efficient at low load: 1 node can fully use the
channel
 At high load: Too many collisions
 Token approach: Can share load fairly and
use channel efficiently
24
Token Ring
 Control token passed
from one node to next T

sequentially.
 Node can send data if
and only if it has token (nothing
to send)
 Problems T
 token overhead
 latency
 single point of failure
(token)

data
25
Summary of multiple access
control
 Channel division
 Random Access
 Taking turn
 Pros and cons

26
LAN: Local Area Network

27
LAN topology

WLAN

Traditional bus

hub, switch

28
Ring
‘Dominant’ wired LAN technology: Ethernet

 IEEE 802.3
 Variant rate: 10 Mbps – 10 Gbps

Metcalfe’s Ethernet
sketch

29
Star topology

 Bus topology is very popular before


 all nodes in same collision domain (can collide with each
other)
 Nowadays: star topology
 A central switch with Ethernet ports
 Switch can establish a connection between any two nodes,
nodes do not collide with each other.

switch

bus: coaxial cable star


30
Ethernet Frame

 Preamble: Start of a frame


 Address: MAC address of source and destination
 6 bytes
 Type: higher layer protocol (IP, Novell IPX,
AppleTalk, …)
 CRC

31
Ethernet LAN

32
LAN addressing and ARP

33
Hub, switch, bridge
 Spanning - Tree

34
Wireless LAN
 Topology
 Security issues
 Media Access Control: CSMA/CA

35
Overview of WAN Technology

36
Next week
 Local area networks
 Physical layer

37
Acknowledgement
 This course materials contains charts and texts
provided by Keio University, Japan
 Some materials from the textbook “Computer
Network, a top down approach” J.F Kurose and
K.W. Ross

38

You might also like