Data Link Layer
Download
Report
Transcript Data Link Layer
• Lower Layers
• Local Area Network Standards
• Point-to-Point Link Layer Protocols
• ARP and RARP
© Jörg Liebeherr (modified by M. Veeraraghavan)
1
TCP/IP Suite and OSI Reference Model
• The TCP/IP protocol stack does not
define the lower layers of a complete
protocol stack.
• In this lecture, we will review the
data link layer and the MAC
sublayer.
• Most of the material should be
familiar from EL 536.
Application
Layer
Application
Layer
Transport
Layer
Network
Layer
(Data) Link
Layer
Layer
Session
Layer
Transport
Layer
Network
Layer
(Data) Link
Layer
Physical
Layer
TCP/IP Suite
© Jörg Liebeherr (modified by M. Veeraraghavan)
Presentation
OSI
Reference
Model
2
Data Link Layer
• The main tasks of the data link layer are:
• Transfer data from the network layer of one machine to
the network layer of another machine.
• Convert the raw bit stream of the physical layer into
groups of bits (“frames”).
• Perform flow control between sender and receiver.
Network
Layer
Data Link
Layer
Network
Layer
Data Link
Layer
Physical
Layer
Physical
Layer
© Jörg Liebeherr (modified by M. Veeraraghavan)
3
Types of Networks
• There are two types of communication networks:
– Broadcast Networks: All stations share a single
communication channel.
– Point-to-Point Networks: Pairs of hosts (or routers) are
directly connected.
Broadcast Network
Point-to-Point Network
• Typically, local area networks (LANs) are broadcast and wide area
networks (WANs) are point-to-point.
© Jörg Liebeherr (modified by M. Veeraraghavan)
4
Local Area Network
• Local area networks (LANs) typically connect computers
within a building or a campus.
• Almost all LANs are broadcast networks.
• Typical topologies of LANs are bus or ring.
Bus LAN
© Jörg Liebeherr (modified by M. Veeraraghavan)
Ring LAN
5
MAC and LLC
• In any broadcast network, the stations must ensure that only
one station transmits at a time on the shared communication
channel.
• The protocol that determines who can transmit on a broadcast
channel is called Medium Access Control (MAC) protocol.
• The higher portion of the data link
layer is often called Logical Link
Control (LLC).
© Jörg Liebeherr (modified by M. Veeraraghavan)
to Network Layer
Data Link
Layer
• The MAC protocol is implemented
in the MAC sublayer which is the
lower sublayer of the data link layer.
Logical Link
Control
Medium Access
Control
to Physical Layer
6
IEEE 802 Standards
• IEEE 802 is a family of standards for LANs.
• The 802 defines the LLC and several MAC sublayers.
Higher Layers
802.1 Interface to Higher Layers
LLC
802.2 Logical Link Control
MAC
802.3
802.4
802.5
802.6
© Jörg Liebeherr (modified by M. Veeraraghavan)
CSMA/CD (Ethernet)
Token Bus
Token Ring
DQDB
7
IEEE 802 LAN Standard
OSI
IEEE
Reference
Model
Logical Link
Control
802.2
802.6
803.5
802.4
802.3
© Jörg Liebeherr (modified by M. Veeraraghavan)
Medium
Access
Control
Physical
Layer
Higher
Layers
Data Link
Layer
Physical
Layer
8
•Unacknowledged connectionless service
•Connection-oriented service
•Acknowledged connectionless service
•IEEE 802.2
•Optical
•:Fiber
•10 Mbps
© Jörg Liebeherr (modified by M. Veeraraghavan)
•FDDI
•DQDB
•Broadband
•Coaxial:
•1,5,10
•Mbps
•Shielded
•twisted
•pair:
•4, 16 Mbps
•Optical
•fiber:
•100
•Mbps
•Optical
•fiber
• or
•coaxial
•44.736
•Mbps
•Carrierband
•1,5,10
•Mbps
•Unshielded
•twisted
•pair:
•4 Mbps
•I•E•E•E••8•0•2•.•6
•Unshielded
•twisted pair:
•1, 10 Mbps
•Token Ring
•F•D•D•I
•P•h•y•s•i•c•a•l
•I•E•E•E••8•0•2•.•3
•Broadband
•coaxial:
•10 Mbps
•Token Bus
•I•E•E•E••8•0•2•.•4
•CSMA/CD
•I•E•E•E••8•0•2•.•5
•M•A•C •L•L•C
IEEE 802 LAN Standard
•Optical fiber
•5,10,20
•Mbps
9
Functions of the LLC
• LLC can provide different services to the network layer:
• acknowledged connectionless service
• unacknowledged connectionless service
• connection-oriented service
• Framing
• Error control
• Addressing
© Jörg Liebeherr (modified by M. Veeraraghavan)
10
Functions of the MAC sublayer
• The various MAC sublayers of the IEEE 802 standard are
very different.
• We will discuss:
– CSMA/CD a.k.a. Ethernet
© Jörg Liebeherr (modified by M. Veeraraghavan)
11
IEEE 802.3 (CSMA/CD)
Transceiver
802.3 standardizes the 1-persistent CSMA/CD multi-access
control protocol.
1. Each station listens before it transmits.
2. If the channel is busy, it waits until the channel goes idle, and then it
transmits.
3. If the channel is idle it transmits immediately. Continue sensing.
4. If collision is detected, transmit a brief jamming signal, then cease
transmission, wait for a random time, and retransmit.
© Jörg Liebeherr (modified by M. Veeraraghavan)
12
Different techniques
•
1-persistent:
– if busy, constantly sense channel
– if idle, send immediately
– if collision is detected, wait a random amount of time before retransmitting
•
Non-persistent:
– sense channel when station has a packet to send
– if busy, wait a random amount of time before sensing again;
– if idle, transmit as soon as it is idle
– collisions reduced because sensing is not immediately rescheduled
– drawback: more delay
•
p-persistent: combines 1-persistent goal of reduced idle channel time with the non-persistent
goal of reduced collisions.
– sense constantly if busy and the station needs to send a packet
– when the channel becomes idle, transmit packet with probability p
– with probability 1-p station waits an additional tprop before sensing again
© Jörg Liebeherr (modified by M. Veeraraghavan)
13
Collisions in Ethernet
• The collision resolution process of Ethernet requires that a
collision is detected while a station is still transmitting.
• Assume: max. propagation delay on the bus is a.
t0
A
A Begins Transmission
B
A
B Begins Transmission
B
t0+a-e
© Jörg Liebeherr (modified by M. Veeraraghavan)
14
Collisions in Ethernet
t0+a
A
B Detects Collision
B
A
A Detects Collision
Just Before End
of Transmission
B
t0 +2a
• Restrictions: Each frame should be at least twice as long as
the time to detect a collision (2 · maximum propagation
delay).
© Jörg Liebeherr (modified by M. Veeraraghavan)
15
Different MAC schemes
• ALOHA: True free-for-all. When a node needs to send, it does
so. It listens for an amount of time equal to the maximum
round trip delay plus a fixed increment. If it hears an
acknowledgment, fine; otherwise it resends. After several
attempts, it gives up. Max. utilization: 18%
• Slotted ALOHA: improved utilization: 37% (with time slots;
frames that overlap, overlap completely)
• CSMA: Sense carrier, if idle, send.Wait for ack. If there isn’t
one, assume there was a collision, retransmit.
© Jörg Liebeherr (modified by M. Veeraraghavan)
16
CSMA/CD
• CSMA/CD:
– In CSMA, if collision occurs, need to wait till damaged
frames have fully propagated. For long frames compared
to propagation delay, this could lead to significant waste of
capacity. So add collision detection.
– Rule: Frames should be long enough to allow collision
detection prior to the end of transmission (pg 405, EL536
textbook)
© Jörg Liebeherr (modified by M. Veeraraghavan)
17
Exponential Backoff Algorithm
• If a station is involved in a collision, it waits a random amount
of time before attempting a retransmission.
• The random time is determined by the following algorithm:
• Set “slot time” to 2a.
• After first collision wait 0 or 1 time unit.
• After i-th collision, wait a random number between
0 and 2 i-1 time slots.
• Do not increase random number range if i=10.
• Give up after 16 collisions.
© Jörg Liebeherr (modified by M. Veeraraghavan)
18
Physical Layer Specifications for 802.3
• Many types of media are allowed for 802.3. These are the
most popular:
Name
Cable
Data Maximum
Comments
Rate
Length
(Mbps)
(m)
10Base5 “Thick
10
500 The “original” from
Coax”
1985
10Base2 “Thin Coax”
10
185 Called “Cheapernet”
or “thin Ethernet”
10BaseT Twisted
10
100 Uses a star topology
pair
(with a central hub).
100BaseT Twisted
100
“Fast Ethernet”
pair
100BaseFX Fiber optics
© Jörg Liebeherr (modified by M. Veeraraghavan)
100
2000 Fiber version of Fast
Ethernet
19
Ethernet and IEEE 802.3: Any Difference?
• On a conceptual level, they are identical. But there are subtle
differences that are relevant if we deal with TCP/IP.
• “Ethernet”:
• An industry standard from 1982 that is based on the first
implementation of CSMA/CD by Xerox.
• Predominant version of CSMA/CD in the US.
• 802.3:
• IEEE’s version of CSMA/CD from 1985.
• Interoperates with 802.2 (LLC) as higher layer.
• Difference for our purposes: Ethernet and 802.3 use
different methods to encapsulate an IP datagram.
© Jörg Liebeherr (modified by M. Veeraraghavan)
20
IEEE 802.2/802.3 Encapsulation (RFC 1042)
802.3 MAC
802.2 LLC
802.2 SNAP
destination
address
source
address
length
DSAP
AA
SSAP
AA
cntl
03
org code
0
type
data
CRC
6
6
2
1
1
1
3
2
38-1492
4
0800
IP datagram
2
38-1492
0806
ARP request/reply
PAD
2
28
10
- destination address, source address:
MAC addresses are 48 bit
- length: frame length in number of bytes
- DSAP, SSAP: always set to 0xaa
- Ctrl:
set to 3
- org code: set to 0
- type field identifies the content of the
data field
- CRC:
cylic redundancy check
0835
RARP request/reply PAD
2
28
10
Error: This should be 8035 not 0835
© Jörg Liebeherr (modified by M. Veeraraghavan)
21
Ethernet Encapsulation (RFC 894 and 893)
Dest. Src.
Addr Addr. Type
.
6
6
2
46-1500
Type
0800
2
Type
0806
2
Type
8035
2
© Jörg Liebeherr (modified by M. Veeraraghavan)
CRC
Data
4
IP
datagram
46-1500
ARP req./reply
28
RARP req./reply
28
PAD
18
PAD
18
22
Interconnection of LANs
• LANs of different types can be interconnected by data link
bridges.
Token-ring
Bridge
IP
IP
LLC
LLC
802.3 MAC
© Jörg Liebeherr (modified by M. Veeraraghavan)
802.3 MAC
LLC
802.5 MAC
802.5 MAC
23