Download Data Link Layer

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Low-voltage differential signaling wikipedia , lookup

Cracking of wireless networks wikipedia , lookup

Zigbee wikipedia , lookup

Asynchronous Transfer Mode wikipedia , lookup

Point-to-Point Protocol over Ethernet wikipedia , lookup

Deep packet inspection wikipedia , lookup

Wake-on-LAN wikipedia , lookup

Computer network wikipedia , lookup

STANAG 3910 wikipedia , lookup

Airborne Networking wikipedia , lookup

Network tap wikipedia , lookup

IEEE 802.1aq wikipedia , lookup

Serial digital interface wikipedia , lookup

IEEE 802.11 wikipedia , lookup

Internet protocol suite wikipedia , lookup

Recursive InterNetwork Architecture (RINA) wikipedia , lookup

CAN bus wikipedia , lookup

IEEE 1355 wikipedia , lookup

UniPro protocol stack wikipedia , lookup

Transcript
Data Link Issues
Relates to Lab 2.
This module covers data link layer issues, such as local area networks
(LANs) and point-to-point links, CSMA, and Ethernet,
1
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 using hop by hop
transmission over single links (single segments).
• Convert the raw bit stream of the physical layer into
groups of bits (“frames”) and vice versa
Network
Layer
Network
Layer
Datagram
Data Link
Layer
Data Link
Layer
Frame
Physical
Layer
Physical
Layer
Electrical and
Optical signals
Hop-by-Hop Transport
Neon
Argon
The actual path
followed by data
Data Link Hop
Single Segment
Data Link Layer
• Datagram transferred by different link protocols over
different links:
 e.g., Ethernet (802.3) on first link, frame relay on
intermediate links, WiFi (802.11) on last link
• Each link protocol provides different services
 e.g., may or may not provide error control over link
4
Data Link Layer Services
• flow control
 pacing between adjacent sending and receiving nodes
• error detection
 errors caused by signal attenuation, noise
 receiver detects presence of errors:
• signals sender for retransmission or drops frame
• error correction
 receiver identifies and corrects bit error(s) without resorting to
retransmission
• transmission - half-duplex and full-duplex
 half duplex - nodes at both ends of link can transmit, but not at same
time
 full duplex – nodes can transmit in both directions at the same time
• channel access
5
Data Link Layer Implementation
• in each and every host
• data link layer implemented in
“adaptor” (aka network
interface card NIC) or on a
chip
– Ethernet card, 802.11 card;
Ethernet chipset
– Implements:
• Data Link layer,
AND
• Physical layer
• attaches into host’s system
buses
• combination of hardware,
software, firmware
controller
physical
transmission
6
Types of “Single Segment” 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
• Examples of single segment networks:
– broadcast: Ethernet, WiFi,
– point to point link: Frame Relay
• Typically, local area networks (LANs) are broadcast and wide
7
area networks (WANs) are point-to-point
Local Area Network (LAN)
• Local area networks (LANs) typically connect devices within a
building or a campus
• Almost all LANs are broadcast networks
• Typical topologies of LANs are bus or ring or star
• LANs use an algorithm to gain access to shared channel to
transmit
Bus LAN
Ring LANHub
Star
8
LANs: Data Link Layer - MAC and LLC
Data Link
Layer
• 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 the Medium Access Control (MAC) protocol
• The MAC protocol is implemented
in the MAC sublayer which is the
to Network Layer
lower sublayer of the data link layer
Logical Link
Control
• The MAC is physical layer/topology
Medium Access
dependent
Control
• The higher portion of the data link
to Physical Layer
layer is often called the Logical Link
Control (LLC)
9
Logic Link Controls
• Frame Structure
– Fields: types, lengths
• Flow Control
– Pacing control:
• none
• stop and go, window control
• Error Control
– None
– Error detection/correction
– Error recovery
10
MAC Protocols
• multiple access protocol
– an algorithm that determines how nodes share channel, i.e., determine
when node can transmit
• Centralized – a master that controls how nodes share the channel
• Distributed – no one in charge, nodes cooperate for access
• three broad classes:
– channel partitioning
• divide channel into smaller “pieces” (time slots, frequency, code)
• allocate a piece to each node a priori for exclusive use
– random access
• channel use not allocated - all nodes can use any piece (or full channel)
• can result in collisions if nodes transmit at the same time
• often implements a mechanism to “recover” from collisions
– round robin “taking turns”
• nodes take turns using pieces or full channel, but nodes with more to send
11
can take longer/larger turns – causing variable delays
Random Access
• when node has packet to send
– transmit at full channel data rate R (generally no pieces)
– NO a priori allocation of channel among nodes
• two or more transmitting nodes on channel ➜ “collision”
• random access MAC protocol specifies:
– how to detect collisions
– how to recover from collisions (e.g., via delayed retransmissions)
• examples of random access MAC protocols:
– slotted ALOHA
– ALOHA
– CSMA, CSMA/CD, CSMA/CA
12
Carrier Sense multiple access (CSMA)
• CSMA: listen before transmit, i.e., don’t interrupt others,
wait until there is a pause:
– if channel sensed idle: transmit entire frame
– if channel sensed busy, defer transmission
• When channel sensed idle: collisions can still occur:
– propagation delay means two nodes may not hear each other’s
transmission and the collision occurs in mid transmission
• When channel sensed busy: collisions can still occur:
– deferred nodes all detect pause at the same time after a transmission
is completed and will attempt to transmit
• Collision: entire packet transmission time wasted
– distance & propagation delay play role in in determining collision
probability
13
CSMA with Collision Detection (CSMA/CD)
• CSMA/CD: carrier sensing, deferral as in CSMA
 collisions detected within short time (propagation delay)
 colliding transmissions aborted and a jam signal transmitted, reducing
channel wastage
• collision detection:
 easy in wired LANs: measure signal strengths, compare transmitted
and received signals
– difficult in wireless LANs: received signal strength overwhelmed by
local transmission strength – detection not functional --> don’t use /CD.
Use Collision Avoidance (CA). Small reservation packets used to
request channel usage. Possible because of centralized architecture
(Access Point (AP).
14
CSMA with Collision Detection (CSMA/CD)
1. NIC receives datagram from network layer, creates frame
2. If NIC senses channel idle, starts frame transmission. If NIC
senses channel busy, waits for pause, then checks if channel
idle. If YES transmits, if NO, repeats - waits for next pause.
3. If NIC transmits entire frame without detecting another
transmission, NIC is done with frame!
4. If NIC detects another transmission while transmitting,
aborts and sends jam signal
5. After aborting, NIC enters binary (exponential) back-off:
– after mth collision, NIC chooses a value K at random from
{0,1,2, …, 2m-1}.
6. NIC waits K·512 bit times, returns to Step 2
– longer back-off interval with more collisions
15
CSMA with Collision Detection (CSMA/CD)
•spatial layout of nodes B and D
16
A LAN Data Link Layer Example: Ethernet II
• LLC very simple:
– Frame structure (next slide)
– connectionless: no handshaking between sending and receiving
NICs
– unreliable: uses error detection only no recovery
• detected error: frame dropped
• receiving NIC doesnt send acks or nacks to sending NIC
• data in dropped frames recovered only if initial sender uses a
reliable higher layer (e.g., TCP), otherwise dropped data lost
• MAC protocol:
– CSMA/CD with binary backoff when collisions occur
5-17
Ethernet II frame structure
• sending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
type
dest.
source
preamble address address
data
(payload)
CRC
• preamble:
 7 bytes with pattern 10101010 followed by one byte with
pattern 10101011
 used to synchronize receiver and sender clock rates
5-18
Ethernet II frame structure (more)
• addresses: 6 byte source/destination MAC addresses
 if adapter receives frame with matching destination address, or
with broadcast address (e.g. ARP packet), it passes data in
frame to upper layer (e.g., IP or ARP)
 otherwise, adapter discards frame
• type: indicates higher layer protocol (mostly IP but others
possible, e.g., Novell IPX, AppleTalk) or ARP
• CRC: cyclic redundancy check at receiver
 error detected: frame is dropped
type
dest.
source
preamble address address
data
(payload)
CRC
5-19
Ethernet II standards: link & physical layers
• many different Ethernet standards
– common MAC protocol and LLC frame format
– different speeds: 2 Mbps, 10 Mbps, 100 Mbps, 1Gbps, 10G bps
– different physical layer media: fiber, cable
application
transport
network
link
physical
MAC protocol
and LLC frame format
100BASE-TX
100BASE-T2
100BASE-FX
100BASE-T4
100BASE-SX
100BASE-BX
copper (twisted
pair) physical layer
fiber physical layer
5-20
Ethernet II Frame vs IEEE 802.3
Note:
• all fields in bytes
• IEEE 802.3 has embedded 8 byte Link Control header 802.2
• Data field is padded if payload is less than < 38bytes
• Ethernet II:
• FCS is CRC
• Data field is padded if payload is less than < 46bytes
21
Ethernet Star Configurations: Hubs vs.
Switches
• An Ethernet switch is a packet switch for Ethernet frames
• Buffering of frames prevents collisions
• Each port is isolated and builds its own collision domain
• An Ethernet Hub does not perform buffering
• Collisions occur if two frames arrive at the same time (WiFi access
points are virtually hubs)
Hub
Switch
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
HighSpeed
Backplane
CSMA/CD
CSMA/CD
CSMA/CD
CSMA/CD
Input
Buffers
Output
Buffers
22