Chapter 5 Link Layer and LANs

A note on the use of these ppt slides:
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 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, 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 you note that they are adapted from (or perhaps identical to) our slides, and note our copyright of this material. 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

Computer Networking: A Top Down Approach Featuring the Internet,
3rd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2004.

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 services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM and MPLS

5: DataLink Layer

5-3

Link Layer: Introduction
Some terminology:
hosts and routers are nodes communication channels that connect adjacent nodes along communication path are links
wired links wireless links LANs

“link”

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 linklayer 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! 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

Reliable delivery between adjacent nodes

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 with half duplex, nodes at both ends of link can transmit, but not at same time 5: DataLink Layer 5-7

Half-duplex and full-duplex

Adapters Communicating
datagram sending node link layer protocol physical link frame adapter rcving node frame adapter

link layer implemented in “adapter” (aka NIC)
Ethernet card, PCMCI card, 802.11 card

receiving side
looks for errors, rdt, flow control, etc extracts datagram and passes to receiving node

sending side:
encapsulates datagram in a frame adds error checking bits, rdt, flow control, etc.

adapter is semi-autonomous
under the control of the node shares housing, power, & buses

link & physical layers
5: DataLink Layer 5-8

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

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:
Detect single bit errors

Two Dimensional Bit Parity:
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 errors is ~50% FEC (Forward Error Correction) can reduce the number of retransmissions with ARQ protocols

0

0

5: DataLink Layer

5-11

Internet checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted segment (note: used at transport layer only)
Sender:
treat segment contents as sequence of 16-bit integers checksum: addition (1’s complement sum) of segment contents sender puts checksum value into checksum field

Receiver:
compute checksum of received segment check if computed checksum equals checksum field value: NO - error detected YES - no error detected. But More later ….

maybe errors nonetheless?

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: equivalently:

D.2r = G XOR R

if we divide D.2r by G, want remainder R R = remainder[ D.2r G
]

Transmit D.2r XOR R = 10111011
5: DataLink Layer 5-14

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

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

a node is limited to average BW of R/N even if it is the only one 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
frequency bands
time

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

requires strict synchronization for coding/decoding 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
all frames have the same size time is divided into equal size slots, each equals the time to transmit 1 frame nodes start to transmit frames only at the beginning of the slots nodes are synchronized if 2 or more nodes transmit within the same slot, all nodes detect the collision

Operation
when a node obtains a fresh frame, it transmits in next slot if no collision occurs, the node can send a new frame in the next slot if a collision occurs, the node retransmits the frame in each subsequent slot with a probability p until success

5: DataLink Layer

5-24

Slotted ALOHA

Pros (advantages) a single active node can continuously transmit at the full rate of channel highly decentralized: only the slots in the nodes need to be in sync simple

Cons (disadvantages) collisions, wasting slots idle slots due to random back off clock synchronization among nodes for the start of the slot
5: DataLink Layer 5-25

Slotted Aloha efficiency
Efficiency in the long-run, when there are many nodes, each with many frames to send, only a fraction of successful slots
Suppose N nodes with many frames to send, each transmits in the slot with probability p The probability that one node has success in a slot = p(1-p)N-1 The probability that any node has a success in a slot = Np(1-p)N-1 For max efficiency with N nodes, find p* that maximizes Np(1-p)N-1 For many nodes, take limit of Np*(1-p*)N-1 as N goes to infinity max. efficiency = 1/e = 37%

At best: a channel
is used for useful transmissions only 37% of time!

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,t0+1] = p . (1-p)N-1 . (1-p)N-1 = p . (1-p)2(N-1)
… finding optimum p as N infinity ...

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

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
collisions can still occur:
due to the propagation delay between nodes, one node may not hear the other’s transmission early enough

spatial layout of nodes

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 single point of failure (the master) token overhead latency 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?
Random Partitioning (dynamic),
• Time Division, Frequency Division, Code Division

Channel Partitioning, by time, frequency or code
• 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 • polling from a central node • token passing • Token Ring used in IEEE 802.5
5: DataLink Layer 5-35

Taking Turns

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

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

71-65-F7-2B-08-53

LAN (wired or wireless)
58-23-D7-FA-20-B0

= adapter

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 address of B knowing B’s IP address?
ARP protocol provides IPto-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
TTL (Time To Live): time after which address mapping will be removed (typically 20 min)

< IP address; MAC address; TTL>

Possible ARP table in node 222.222.222.220

5: DataLink Layer

5-40

ARP protocol: Same LAN (network)
A wants to send datagram to B, and B’s MAC address not in A’s ARP table. A broadcasts ARP query packet, containing B's IP address Dest MAC address = FF-FF-FF-FF-FF-FF all machines on LAN receive the ARP query B receives the ARP query, replies to A with its (B's) MAC address
frame sent to A’s MAC address is a standard or unicast frame

A caches (saves) IP-toMAC address pair in its ARP table until information becomes old (times out) soft state: information that times out (goes away) unless refreshed

ARP is “plug-and-play”:
nodes create their ARP tables without intervention from net administrator

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

B
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

A R
SIP=A, SMAC=1A-23-F9-CD-06-9B DIP=B, DMAC=49-BD-D2-C7-56-2A

B
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

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)

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 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 services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM

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 datagram from the network layer & creates the frame If the adapter senses that the channel is idle for 96 bit times, it starts to transmit the frame. If it senses that the channel is busy, it waits until the channel is idle (plus 96 bit times), then and then transmits If the adapter transmits the entire frame without detecting another transmission, the adapter is done with frame !

4.

2.

If the adapter detects another transmission while transmitting, it aborts and sends a 48-bit jam signal to let others know After aborting, the adapter enters an exponential backoff: after the mth collision, adapter chooses a random number K from {0,1,2,…,2m-1} and waits K·512 bit times and returns to Step 2

5.

3.

5: DataLink Layer

5-54

Ethernet’s CSMA/CD (more)
Jam Signal: make sure that all other transmitters are aware of the collision Bit time: 0.1 microsec for 10 Mbps Ethernet; for K=1023, wait time is: 1023x512x0.1 microsec= 50 msec See/interact with Java applet on AWL Web site: highly recommended ! Exponential Backoff: Goal: adapt the retransmission attempts to the estimated current number of colliding nodes
for larger number of colliding nodes: random wait will be longer

first collision: choose K from {0,1}; delay = K· 512 bit transmission times after second collision: choose K from {0,1,2,3}… after ten or more collisions, 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

efficiency =

1 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 services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Interconnections: Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM

5: DataLink Layer

5-61

Interconnecting with hubs
provides inter-segment host-tohost communication ☺ extends the max. distance between hosts ☺ provides a degree of graceful degradation ☺
malfunctioning hubs are isolated

individual segment collision domains become one large collision domain
aggregate throughput is reduced

can’t interconnect 10 & 100BaseT some performance restrictions:
max. number of nodes and max. distance in a collision domain max. number of tiers

Multi-tier Hub Design

Backbone hub

hub

hub

hub

Computer Engineering

Computer Science

Information Systems
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
1 2 switch 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
1 switch 2 3 hub D F G hub I E H address interface A B E G 1 1 2 3

A B C

hub

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.
1 switch 2 3 hub D F G hub I E H address interface A B E G C D 1 1 2 3 1 2

A B C

hub

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 services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-Layer Addressing 5.5 Ethernet 5.6 Hubs and switches 5.7 PPP 5.8 Link Virtualization: ATM

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

Sign up to vote on this title
UsefulNot useful