0% found this document useful (0 votes)
513 views83 pages

Networks - Chapter 5 - Data Link Layer 1spp

This document discusses the data link layer and its goals, services, and technologies. It covers topics like error detection, multiple access protocols, link layer addressing, and Ethernet. It also discusses concepts like framing, reliable delivery, flow control, and error correction between adjacent nodes.

Uploaded by

Seif Hawamdeh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
513 views83 pages

Networks - Chapter 5 - Data Link Layer 1spp

This document discusses the data link layer and its goals, services, and technologies. It covers topics like error detection, multiple access protocols, link layer addressing, and Ethernet. It also discusses concepts like framing, reliable delivery, flow control, and error correction between adjacent nodes.

Uploaded by

Seif Hawamdeh
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 83

Chapter 5

Link Layer and LANs

A note on the use of these ppt slides:


Computer Networking:
We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously A Top Down Approach
Featuring the Internet,
represent a lot of work on our part. In return for use, we only ask the
following:
If you use these slides (e.g., in a class) in substantially unaltered form, 3rd edition.
that you mention their source (after all, we’d like people to use our book!)
If you post any slides in substantially unaltered form on a www site, that Jim Kurose, Keith Ross
you note that they are adapted from (or perhaps identical to) our slides, and Addison-Wesley, July
note our copyright of this material.
2004.
Thanks and enjoy! JFK/KWR

All material copyright 1996-2004


J.F Kurose and K.W. Ross, All Rights Reserved
5: DataLink Layer 5-1
Chapter 5: The Data Link Layer
Our goals:
understand principles behind data link layer services:
error detection, correction: done (Data Communications)
sharing a broadcast channel: multiple access
link layer addressing
reliable data transfer, flow control: done!
instantiation and implementation of various link layer
technologies

5: DataLink Layer 5-2


Link Layer
5.1 Introduction and 5.6 Hubs and switches
services 5.7 PPP
5.2 Error detection 5.8 Link Virtualization:
and correction ATM and MPLS
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5: DataLink Layer 5-3


Link Layer: Introduction
“link”
Some terminology:
hosts and routers are nodes
communication channels that
connect adjacent nodes along
communication path are links
wired links
wireless links
LANs
layer-2 packet is a frame that
encapsulates a datagram

data-link layer has the responsibility of


transferring a datagram from one node
to an adjacent node over a link
5: DataLink Layer 5-4
Link layer: context
Datagrams are transferred by different link-
layer protocols over different links:
e.g., Ethernet on first link, frame relay on
intermediate links, 802.11 on last link
Each link-layer protocol may provide different
services from others
e.g., it may or may not provide rdt over the link

5: DataLink Layer 5-5


Link Layer Services
Framing, link access:
encapsulate datagram into frame, adding header/trailer
coordinate channel access if the medium is shared
“MAC” (Medium Access Control) addresses are used in frame
headers to identify the source and destination:
• different from IP address!
Reliable delivery between adjacent nodes
we learned how to do this already (chapter 3)!
seldom used on low bit error link (fiber, some twisted pair)
wireless links usually have high error rates
• Q: why both link-level and end-end reliability?
– not all protocols provide it
– faster and more efficient if provided locally at a lower layer
– some errors may not be detected during transition (e.g.; router buffer)

5: DataLink Layer 5-6


Link Layer Services (more)
Flow Control:
pacing between adjacent sending and receiving nodes
nodes and each side of the link have limited buffering
Error Detection:
errors may be caused by signal attenuation or noise
receiver detects presence of errors:
• signals the sender for retransmission or drops the frame
Error Correction:
receiver node may identify and/or correct bit error(s)
without resorting to retransmission
usually more sophisticated and hardware-based methods
Half-duplex and full-duplex
with half duplex, nodes at both ends of link can transmit, but
not at same time 5: DataLink Layer 5-7
Adapters Communicating
datagram
link layer protocol rcving
sending node
node
frame physical link frame
adapter adapter

link layer implemented in receiving side


“adapter” (aka NIC) looks for errors, rdt, flow
Ethernet card, PCMCI card, control, etc
802.11 card extracts datagram and passes to
sending side: receiving node
encapsulates datagram in a adapter is semi-autonomous
frame under the control of the node
adds error checking bits, rdt, shares housing, power, & buses
flow control, etc. link & physical layers

5: DataLink Layer 5-8


Link Layer
5.1 Introduction and 5.6 Hubs and switches
services 5.7 PPP
5.2 Error detection 5.8 Link Virtualization:
and correction ATM
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5: DataLink Layer 5-9


Error Detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields

• Error detection not 100% reliable!


• protocol may miss some errors, but rarely
• larger EDC field yields better detection and correction

5: DataLink Layer 5-10


Parity Checking
Single Bit Parity: Two Dimensional Bit Parity:
Detect single bit errors Detect and correct single bit errors

detects odd number of errors


efficient only if the bit error
probability is low and/or bit errors
are independent
but in fact, errors are dependent
and occur in bursts
with burst errors & single parity
bit, the probability of undetected 0 0
errors is ~50%
FEC (Forward Error Correction) can
reduce the number of
retransmissions with ARQ protocols
5: DataLink Layer 5-11
Internet checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment (note: used at transport layer only)
Sender: Receiver:
treat segment contents as compute checksum of received
sequence of 16-bit integers segment
checksum: addition (1’s check if computed checksum equals
complement sum) of segment checksum field value:
contents NO - error detected
sender puts checksum value into YES - no error detected. But
checksum field maybe errors nonetheless?
More later ….

Checksum methods have little packet overhead. However,


they provide relatively weak protection against errors
5: DataLink Layer 5-12
Checksumming: Cyclic Redundancy Check
view data bits, D, as a binary number
choose r+1 bit pattern (generator), G
goal: choose r CRC bits, R, such that
<D,R> exactly divisible by G (in modulo 2 arithmetic or XOR)
receiver knows G, divides <D,R> by G. If non-zero remainder: error is
detected!
can detect all burst errors less than r+1 bits & all odd number of errors
larger burst errors of length r can be detected with prob. of 1-0.5^r
widely used in practice (e.g. ATM)

5: DataLink Layer 5-13


CRC Example
Want:
D.2r XOR R = G
equivalently:
D.2r = G XOR R
equivalently:
if we divide D.2r by
G, want remainder R

D.2r
R = remainder[ ]
G
Transmit D.2r XOR R = 10111011

5: DataLink Layer 5-14


Link Layer
5.1 Introduction and 5.6 Hubs and switches
services 5.7 PPP
5.2 Error detection 5.8 Link Virtualization:
and correction ATM
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5: DataLink Layer 5-15


Multiple Access Links and Protocols
Two types of “links”:
point-to-point
PPP (Point-to-Point Protocol) for dial-up access
point-to-point link between Ethernet switch and host
broadcast (shared wire or medium)
traditional Ethernet
802.11 wireless LAN

5: DataLink Layer 5-16


Multiple Access protocols
consider a single shared broadcast channel
two or more simultaneous transmissions by nodes cause
an interference, which causes a packet collision
collision: if a node receives two or more signals at the same time
the collision happens at all the nodes sharing the channel
collisions waste some of the broadcast channel bandwidth

multiple access protocol


distributed algorithm that determines how nodes can
share a channel, i.e., determine when nodes can transmit
communication about the channel sharing must use the
channel itself!
no out-of-band channel for coordination

5: DataLink Layer 5-17


Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1. When only one node wants to transmit, it
can send at rate R.
2. When M nodes want to transmit, each can
send, on average, at rate R/M
3. Fully decentralized:
no special node to coordinate transmissions
no synchronization of clocks or time-slots
4. Simple and cost-effective to implement

5: DataLink Layer 5-18


MAC Protocols: a taxonomy
Three broad classes:
Channel Partitioning
divide the channel into smaller “pieces” such as time slots
(e.g. TDMA), frequency bands (e.g. FDMA), codes (e.g. CDMA)
allocate each piece to a node for exclusive use
Random Access
the channel is not divided but shared allowing collisions
there is a mechanism to “recover” from collisions
“Taking turns”
nodes take turns, but nodes with more to send can take
longer turns

5: DataLink Layer 5-19


Channel Partitioning MAC protocols: TDMA
TDMA: Time Division Multiple Access
access to channel in "rounds"
each station gets fixed length slot (length = packet transmission
time) in each round
unused slots go idle
example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle

Two major drawbacks:


1. a node is limited to average BW of R/N even if it is the only one
2. a node must always wait for its turn even if it is the only one

5: DataLink Layer 5-20


Channel Partitioning MAC protocols: FDMA
FDMA: Frequency Division Multiple Access
the channel spectrum is divided into frequency bands
each station is assigned a fixed frequency band
unused transmission time in frequency bands go idle
the same limited BW drawback as the TDMA
example: 6-station LAN, 1,3,4 have pkt, frequency bands
2,5,6 idle

time
frequency bands

5: DataLink Layer 5-21


Channel Partitioning MAC protocols: CDMA
CDMA: Code Division Multiple Access
each node is assigned a unique code
each node uses its code to encode the data bits it sends
the codes are orthogonal (i.e.; different codes cancel or flatten
each other at the receiver)
all other signals behave as background noise to one another
the receiver node knows the code of the sender node
the receiver decodes the intended signal using its sender code
all nodes can use the channel simultaneously
may need a separate code for control signaling

drawbacks:
1. requires strict synchronization for coding/decoding
2. fairly complex implementation

5: DataLink Layer 5-22


Random Access Protocols
when a node has a packet to send
transmit at full channel data rate R
no a priori coordination among nodes
two or more transmitting nodes ➜ “collision”,
random access MAC protocol specifies:
how to detect (or avoid) collisions
how to recover from collisions (e.g., via delayed retransmissions)
examples of random access MAC protocols:
slotted ALOHA
pure (unslotted) ALOHA
CSMA, CSMA/CD, CSMA/CA

5: DataLink Layer 5-23


Slotted ALOHA
Assumptions Operation
all frames have the same size when a node obtains a fresh
time is divided into equal size frame, it transmits in next
slots, each equals the time to slot
transmit 1 frame if no collision occurs, the
nodes start to transmit node can send a new frame
frames only at the beginning in the next slot
of the slots if a collision occurs, the
nodes are synchronized node retransmits the frame
if 2 or more nodes transmit in each subsequent slot with
within the same slot, all a probability p until success
nodes detect the collision

5: DataLink Layer 5-24


Slotted ALOHA

Pros (advantages) Cons (disadvantages)


a single active node can collisions, wasting slots
continuously transmit at idle slots due to
the full rate of channel random back off
highly decentralized: clock synchronization
only the slots in the among nodes for the
nodes need to be in sync start of the slot
simple
5: DataLink Layer 5-25
Slotted Aloha efficiency
Efficiency in the long-run, when For max efficiency with N
nodes, find p* that
there are many nodes, each maximizes Np(1-p)N-1
with many frames to send, only
For many nodes, take limit
a fraction of successful slots of Np*(1-p*)N-1 as N goes
to infinity
Suppose N nodes with many max. efficiency = 1/e = 37%
frames to send, each transmits in
the slot with probability p

The probability that one node has At best: a channel


success in a slot = p(1-p)N-1 is used for useful
transmissions only
The probability that any node has 37% of time!
a success in a slot = Np(1-p)N-1

5: DataLink Layer 5-26


Pure (unslotted) ALOHA
unslotted Aloha: simpler as there is no synchronization
when a frame first arrives, transmit immediately
collision probability increases:
frame sent at t0 collides with other frames sent in [t0-1,t0+1]

5: DataLink Layer 5-27


Pure Aloha efficiency
P(success by given node) = P(node transmits) .

P(no other node transmits in [t0-1,t0] .


P(no other node transmits in [t0,t0+1]
= p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)

… finding optimum p as N infinity ...

max. efficiency = 1/(2e) = 18%

Even worse than slotted ALOHA!

5: DataLink Layer 5-28


CSMA (Carrier Sense Multiple Access)

CSMA: listen before transmitting:


if the channel is sensed idle, transmit the entire frame
if the channel is sensed busy, defer transmission

human analogy: don’t interrupt others!

can this prevents collisions?

5: DataLink Layer 5-29


CSMA collisions spatial layout of nodes

collisions can still occur:


due to the propagation delay
between nodes, one node may
not hear the other’s
transmission early enough
collision:
the entire packet transmission
time is wasted (the nodes
keep transmitting regardless)
note:
the important role of distance &
propagation delay in determining
collision probability!

5: DataLink Layer 5-30


CSMA/CD (Collision Detection)
CSMA/CD: carrier sensing & deferral as in CSMA
collisions are detected within a short time
colliding transmissions are aborted, reducing the
channel wastage
collision detection:
easy in wired LANs: measure signal strengths,
compare transmitted and received signals
difficult in wireless LANs: receiver shut off while
transmitting (hence WLAN uses collision avoidance)
human analogy: the polite conversationalist

5: DataLink Layer 5-31


CSMA/CD collision detection

5: DataLink Layer 5-32


“Taking Turns” MAC protocols
channel partitioning MAC protocols:
share channel efficiently and fairly at high load
inefficient at low load: there is delay in channel
access and only 1/N of the bandwidth is allocated
even if there is only 1 active node!
Random access MAC protocols:
efficient at low load: a single node can fully
utilize the channel
Decreasing efficiency at high load: collision
overhead
“taking turns” protocols:
look for the best of both worlds!

5: DataLink Layer 5-33


“Taking Turns” MAC protocols
Polling: Token passing:
a master node a control token is passed
“invites” slave nodes from one node to the next
to transmit in turn sequentially
concerns: decentralized and efficient
polling overhead concerns:
latency token overhead
single point of latency
failure (the master)
single point of failure:
• token not passed
• failure of one node can break
the channel

5: DataLink Layer 5-34


Summary of MAC protocols
What do you do with a shared medium?
Channel Partitioning, by time, frequency or code
• Time Division, Frequency Division, Code Division
Random Partitioning (dynamic),
• ALOHA, S-ALOHA, CSMA, CSMA/CD
• carrier sensing: easy in some technologies (wire), hard
in others (wireless)
• CSMA/CD used in IEEE 802.3 Ethernet
• CSMA/CA used in IEEE 802.11 WLAN
Taking Turns
• polling from a central node
• token passing
• Token Ring used in IEEE 802.5

5: DataLink Layer 5-35


Link Layer
5.1 Introduction and 5.6 Hubs and switches
services 5.7 PPP
5.2 Error detection 5.8 Link Virtualization:
and correction ATM
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5: DataLink Layer 5-36


MAC Addresses and ARP
IP address:
network-layer address
32/128-bit logical address assigned to an interface
used to get the datagram to the destination IP subnet
hierarchical structure
MAC (or LAN or physical or Ethernet) address:
link-layer address
unique 48-bit physical address burned in the adapter’s ROM
used to get the frame from one to another physically-
connected interfaces (within the same network)
flat structure

5: DataLink Layer 5-37


LAN Addresses and ARP
Each adapter on the LAN has a unique LAN address

1A-2F-BB-76-09-AD Broadcast address =


FF-FF-FF-FF-FF-FF

LAN
(wired or = adapter
wireless)
71-65-F7-2B-08-53
58-23-D7-FA-20-B0

0C-C4-11-6F-E3-98

5: DataLink Layer 5-38


LAN Address (more)
MAC address allocation is administered by IEEE
manufacturer buys portion of MAC address space
(16 million block) in order to assure uniqueness
Analogy:
(a) MAC address: like Social Security Number
(b) IP address: like postal address
MAC is a flat address ➜ insures portability
can move the same adapter from one LAN to another
IP hierarchical address is NOT portable
depends on the IP subnet to which node is attached to

5: DataLink Layer 5-39


ARP: Address Resolution Protocol
Question: how to determine MAC ARP protocol provides IP-
address of B knowing B’s IP address? to-MAC translation
mechanism
ARP is similar to DNS
except that it is used
within the same subnet
Each IP node (Host,
Router) on the LAN has an
ARP table
ARP Table: IP/MAC
address mappings for some
LAN nodes
< IP address; MAC address; TTL>
TTL (Time To Live): time
after which address
mapping will be removed
(typically 20 min)

Possible ARP table in node 222.222.222.220 5: DataLink Layer 5-40


ARP protocol: Same LAN (network)
A wants to send datagram A caches (saves) IP-to-
to B, and B’s MAC address MAC address pair in its
not in A’s ARP table. ARP table until information
A broadcasts ARP query becomes old (times out)
packet, containing B's IP soft state: information
address that times out (goes
Dest MAC address = away) unless refreshed
FF-FF-FF-FF-FF-FF ARP is “plug-and-play”:
all machines on LAN nodes create their ARP
receive the ARP query tables without
B receives the ARP query, intervention from net
replies to A with its (B's) administrator
MAC address
frame sent to A’s MAC
address is a standard or
unicast frame

5: DataLink Layer 5-41


Routing off the subnet to another LAN
walkthrough: send datagram from A to B via R
assume A know’s B IP address

A
R

the router has an IP address, an ARP table, and an adapter for


each interface (i.e.; for each IP network or LAN connected to it)

5: DataLink Layer 5-42


A creates a datagram with source A, destination B
A uses ARP to get R’s MAC address for 111.111.111.110
A creates a link-layer frame with R's MAC address as destination.
The frame contains A-to-B IP datagram
A’s adapter sends the frame and R’s adapter receives it
R removes the IP datagram from the Ethernet frame, sees that it
is destined to B, and uses ARP to get B’s MAC address
R creates a frame containing A-to-B IP datagram and sends it to B

SIP=A, SMAC=74-29-9C-E8-FF-55
DIP=B, DMAC=E6-E9-00-17-BB-4B

R
SIP=A, SMAC=1A-23-F9-CD-06-9B

B
DIP=B, DMAC=49-BD-D2-C7-56-2A

5: DataLink Layer 5-43


DHCP (Dynamic Host Configuration Protocol)
It is a client-server protocol
Used by arriving host to get network configuration information
such as its own IP address and IP address of the gateway or router
Each subnet usually has a DHCP server or a relay agent (typically a
router) that knows the address of the DHCP server

5: DataLink Layer 5-44


DHCP Client-Server Interaction Process
DHCP server discovery: a client must find a server to interact with
DHCP discover message: sent (or broadcasted) by the client
• within a UDP segment to port 67
• within a datagram with broadcast IP address 255.255.255.255 and “this
host” source IP address of 0.0.0.0
• within a frame with broadcast MAC address FF-FF-FF-FF-FF-FF
the frame will be received by the server or relayed to it by the agent
the message contains a transaction ID to match responses to requests
DHCP server offer(s): at least one server offers the information
DHCP offer message: sent by one or more DHCP server to the client
• each offer contains the transaction ID of the request, a proposed IP
address, a subnet mask, a lease-time (i.e.; the amount of time the IP
address will be valid for)
DHCP request: the client chooses one of the offers and responds
with a DHCP request message echoing back the configuration info.
DHCP ACK: the server confirms the requested parameters by
sending a DHCP ACK message to the client

5: DataLink Layer 5-45


DHCP Client-Server Interaction Process

5: DataLink Layer 5-46


Link Layer
5.1 Introduction and 5.6 Hubs and switches
services 5.7 PPP
5.2 Error detection 5.8 Link Virtualization:
and correction ATM
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5: DataLink Layer 5-47


Ethernet (IEEE 802.3)
It is the “dominant” wired LAN technology. Why?
cheap: $20 for 100Mbs!
first widely used LAN technology
simpler & cheaper than token ring LANs and ATM
kept up with speed race: 10 Mbps – 10 Gbps

Metcalfe’s Ethernet
Sketch 30 years ago

5: DataLink Layer 5-48


Star topology
The original Ethernet used a bus topology (10Base2 with
thin coaxial cable) and was popular through mid 90s
Now star topology prevails
Connection choices: hub or switch (more later)

hub or
switch

5: DataLink Layer 5-49


Ethernet Frame Structure
The sending adapter encapsulates the IP datagram (or
other network layer protocol packet) in Ethernet frame

Preamble:
7 bytes with pattern 10101010 followed by one byte
with pattern 10101011
used to wakeup and synchronize the receiver and sender
clock
the last two bits in the 8th byte indicate the start of
the frame contents
the end of the frame is detected by the absence of the
current on the cable
5: DataLink Layer 5-50
Ethernet Frame Structure (more)
Addresses: 6 bytes
if the adapter receives a frame with matching destination
address, or with broadcast address (e.g. ARP packet), it
passes data in frame to the intended network-layer protocol
otherwise, the adapter discards the frame
Type: indicates the higher layer protocol (mostly IP
but others may be supported such as Novell IPX and
AppleTalk)
CRC: checked at receiver, if error is detected, the
frame is simply dropped

5: DataLink Layer 5-51


Unreliable, connectionless service
All Ethernet technologies are connectionless and unreliable

Connectionless: No handshaking between sending and


receiving adapter.
Unreliable: receiving adapter doesn’t send ACK or
NAK to sending adapter
the stream of datagrams that is passed to network layer
can have gaps
gaps will be filled if the application is using TCP
otherwise, the application will see the gaps

This makes Ethernet very simple and inexpensive

5: DataLink Layer 5-52


Ethernet uses CSMA/CD
No time slots
adapter doesn’t transmit if it senses that some
other adapter is transmitting, that is, carrier sense
transmitting adapter aborts when it senses that
another adapter is transmitting, that is, it uses
collision detection
Before attempting a retransmission, adapter waits a
random time, that is, it uses random access

5: DataLink Layer 5-53


Ethernet CSMA/CD algorithm
1. The adaptor receives the 4. If the adapter detects
datagram from the network another transmission while
layer & creates the frame transmitting, it aborts and
sends a 48-bit jam signal to
2. If the adapter senses that let others know
the channel is idle for 96 bit
times, it starts to transmit 5. After aborting, the adapter
the frame. If it senses that enters an exponential
the channel is busy, it waits backoff: after the mth
until the channel is idle (plus collision, adapter chooses a
96 bit times), then and then random number K from
transmits {0,1,2,…,2m-1} and waits
K·512 bit times and returns
3. If the adapter transmits the to Step 2
entire frame without
detecting another
transmission, the adapter is
done with frame ! 5: DataLink Layer 5-54
Ethernet’s CSMA/CD (more)
Jam Signal: make sure that all Exponential Backoff:
other transmitters are Goal: adapt the retransmission
aware of the collision attempts to the estimated
current number of colliding nodes
for larger number of colliding
Bit time: 0.1 microsec for 10
nodes: random wait will be longer
Mbps Ethernet;
for K=1023, wait time is: first collision: choose K from
1023x512x0.1 microsec= {0,1}; delay = K· 512 bit
50 msec transmission times
after second collision: choose K
See/interact with Java from {0,1,2,3}…
applet on AWL Web site: after ten or more collisions,
highly recommended ! choose K from {0,1,2,3,4,…,1023}

5: DataLink Layer 5-55


CSMA/CD efficiency
Tprop = max propagation time between 2 nodes in LAN
ttrans = time to transmit max-size frame

1
efficiency =
1 + 5t prop / ttrans
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity
Much better than ALOHA and still decentralized,
simple, and cheap

5: DataLink Layer 5-56


10BaseT and 100BaseT
10/100 Mbps rate; latter called “fast ethernet”
T stands for Twisted Pair
Nodes connect to a hub: “star topology” with 100 m
max distance between each node and the hub (i.e.;
the max. distance between any pair of node is 200 m)

twisted pair

hub

5: DataLink Layer 5-57


Hubs
Hubs are essentially physical-layer repeaters:
bits coming from one link go out on all other links
receive and transmit at the same rate
no frame buffering
no CSMA/CD at hub: adapters detect collisions
provide network management functionality:
• detect and isolate malfunctioning adapters
• can collect traffic information and pass it to a connected host

twisted pair

hub

5: DataLink Layer 5-58


Manchester encoding

Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to
synchronize to each other
no need for a centralized, global clock among nodes!
100BaseT uses the more efficient 4B5B encoding
Hey, this is physical-layer stuff!
5: DataLink Layer 5-59
Gbit Ethernet (IEEE 802.3z & .3ae)
uses standard Ethernet frame format
allows for point-to-point links (via switches) and
shared broadcast channels (via hubs)
in the shared mode, CSMA/CD is used and short
distances between nodes are required for efficiency
uses hubs, called here “Buffered Distributors”
Full-Duplex at 1 Gbps for point-to-point links
used as backbone to connect multiple 10/100Mbps
Used to run on fiber but now on cat-5 UTP cable
10 Gbps is available now !

5: DataLink Layer 5-60


Link Layer
5.1 Introduction and 5.6 Interconnections:
services Hubs and switches
5.2 Error detection 5.7 PPP
and correction 5.8 Link Virtualization:
5.3Multiple access ATM
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5: DataLink Layer 5-61


Interconnecting with hubs
provides inter-segment host-to- individual segment collision domains
host communication ☺ become one large collision domain
extends the max. distance aggregate throughput is reduced
between hosts ☺ can’t interconnect 10 & 100BaseT
provides a degree of graceful some performance restrictions:
degradation ☺ max. number of nodes and max.
malfunctioning hubs are isolated distance in a collision domain
max. number of tiers

Multi-tier Hub Design Backbone hub

hub
hub hub

Computer Engineering Information Systems


Computer Science
5: DataLink Layer 5-62
Switch
Link-layer device
stores and forwards Ethernet frames
examines the frame header and selectively forwards the frame
based on the MAC dest address
when a frame is to be forwarded on a segment, the switch uses
CSMA/CD to access the segment
transparent
hosts are unaware of the presence of switches
plug-and-play, self-learning
switches do not need to be configured
advantages of switched compared to hubs:
LAN segments are connected while each is an isolated collision domain
• better aggregate throughput
can interconnect different LAN technologies
no limit on the LAN size when interconnected via a switch
5: DataLink Layer 5-63
Forwarding
switch
1
2 3

hub
hub hub

How to determine onto which LAN segment to


forward a frame?
Looks like a routing problem...

5: DataLink Layer 5-64


Self learning
a switch has a switch table
entry in the switch table:
(MAC Address, Interface, Time Stamp of the entry)
stale entries in table dropped (TTL can be 60 min)
switch learns which hosts can be reached through
which interfaces
when a frame is received, the switch “learns” the
location of the sender; the incoming LAN segment
records sender/location pair in switch table

5: DataLink Layer 5-65


Filtering/Forwarding
When switch receives a frame:

index the switch table using the MAC dest address


if entry is found for the destination
then{
if dest is on segment from which frame arrived
then drop the frame
else forward the frame on interface indicated
}
else flood
forward on all but the interface
on which the frame arrived

5: DataLink Layer 5-66


Switch example
Suppose C sends a frame to D

switch address interface


1 A 1
2 3
B 1
E 2
hub hub hub G 3
A
I
D F
B C G H
E

the switch receives the frame from C


notes in the switch table that C is on interface 1
because D is not in the table, the switch forwards the
frame into interfaces 2 and 3
frame is received by D 5: DataLink Layer 5-67
Switch example
Suppose D replies back with frame to C.

address interface
switch
1 A 1
2 3
B 1
E 2
hub hub hub G 3
A
I C 1
D 2
D F
B C G H
E

the switch receives a frame from D


notes in the switch table that D is on interface 2
because C is in table, the switch forwards the frame only
to interface 1
frame is received by C 5: DataLink Layer 5-68
Switch: traffic isolation
the switch installation breaks the subnet into LAN
segments
The switch filters the packets:
same-LAN-segment frames not usually
forwarded onto other LAN segments
segments become separate collision domains

switch

collision
domain

hub
hub hub

collision domain collision domain 5: DataLink Layer 5-69


Switches: dedicated access
switch with many interfaces
hosts have direct
connection to switch
no collisions full duplex
aggregate throughput
increases

Switching: A-to-A’ and B-to-B’


simultaneously, no collisions

5: DataLink Layer 5-70


More on Switches
cut-through switching: the frame is
forwarded from the input to the output port
without first collecting the entire frame
slight reduction in latency
combinations of shared/dedicated,
10/100/1000 Mbps interfaces

5: DataLink Layer 5-71


Institutional network

5: DataLink Layer 5-72


Switches vs. Routers
both store-and-forward devices
routers are network layer devices (examine network
layer headers)
switches are link layer devices
routers maintain routing tables, implement routing
algorithms
switches maintain switch tables, implement
filtering, learning algorithms

5: DataLink Layer 5-73


Summary comparison

5: DataLink Layer 5-74


Link Layer
5.1 Introduction and 5.6 Hubs and switches
services 5.7 PPP
5.2 Error detection 5.8 Link Virtualization:
and correction ATM
5.3Multiple access
protocols
5.4 Link-Layer
Addressing
5.5 Ethernet

5: DataLink Layer 5-75


Point to Point Data Link Control
one sender, one receiver, one link: easier than
broadcast link:
no Media Access Control
no need for explicit MAC addressing
e.g., dialup link, ISDN line
popular point-to-point DLC protocols:
PPP (point-to-point protocol)
HDLC: High level data link control (Data link
used to be considered “high layer” in protocol
stack!

5: DataLink Layer 5-76


PPP Design Requirements [RFC 1557]

packet framing: encapsulation of network-layer


datagram in data link frame
carry network layer data of any network layer
protocol (not just IP) at same time
ability to demultiplex upwards
bit transparency: must carry any bit pattern in the
data field
error detection (no correction)
connection liveness: detect, signal link failure to
network layer
network layer address negotiation: endpoint can
learn/configure each other’s network address
5: DataLink Layer 5-77
PPP non-requirements

no error correction/recovery
no flow control
out of order delivery OK
no need to support multipoint links (e.g., polling)

Error recovery, flow control, data re-ordering


all relegated to higher layers!

5: DataLink Layer 5-78


PPP Data Frame
Flag: delimiter (framing)
Address: does nothing (only one option)
Control: does nothing; in the future possible
multiple control fields
Protocol: upper layer protocol to which frame
delivered (eg, PPP-LCP, IP, IPCP, etc)

5: DataLink Layer 5-79


PPP Data Frame
info: upper layer data being carried
check: cyclic redundancy check for error
detection

5: DataLink Layer 5-80


Byte Stuffing
“data transparency” requirement: data field must
be allowed to include flag pattern <01111110>
Q: is received <01111110> data or flag?

Sender: adds (“stuffs”) extra < 01111110> byte


after each < 01111110> data byte
Receiver:
two 01111110 bytes in a row: discard first byte,
continue data reception
single 01111110: flag byte

5: DataLink Layer 5-81


Byte Stuffing

flag byte
pattern
in data
to send

flag byte pattern plus


stuffed byte in
transmitted data

5: DataLink Layer 5-82


PPP Data Control Protocol
Before exchanging network-
layer data, data link peers
must
configure PPP link (max.
frame length,
authentication)
learn/configure network
layer information
for IP: carry IP Control
Protocol (IPCP) msgs
(protocol field: 8021) to
configure/learn IP
address
5: DataLink Layer 5-83

You might also like