5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

80
5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking

Transcript of 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

Page 1: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-1

Chapter 5Data Link Layer

CMPT 371Data Communications

and Networking

Page 2: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-2

Chapter 5: The Data Link LayerOur goals: understand principles behind data link layer

services: error detection, correction sharing a broadcast channel: multiple access link layer addressing reliable data transfer, flow control: done!

instantiation and implementation of various link layer technologies

Page 3: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-3

Chapter 5 outline

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols CDMA Aloha, CSMA/CD

5.4 Ethernet

5.5 Hubs and switches 5.6 Wireless links and

LANs 802.11 (WiFi)

Page 4: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-4

Link Layer: IntroductionSome terminology: hosts and routers are nodes (bridges and switches too) communication channels that

connect adjacent nodes along communication path are links wired links wireless links LANs

Data unit is a frame, encapsulates datagram

“ link”

data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

Page 5: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-5

Where is the link layer implemented !

link layer implemented in “adaptor” (aka NIC) or on a chip Ethernet card, 802.11

card/chipset

Combining hardware, software, firmware

sendingnode

frame

rcvingnode

datagram

frame

adapter adapter

link layer protocol

Page 6: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-6

Link layer: context

Datagram transferred by different link protocols over different links: e.g., Ethernet on first

link, frame relay on intermediate links, 802.11 on last link

Each link protocol provides different services e.g., may or may not

provide rdt over link

transportation analogy trip from Princeton to

Lausanne limo: Princeton to JFK plane: JFK to Geneva train: Geneva to Lausanne

tourist = datagram transport segment =

communication link transportation mode =

link layer protocol travel agent = routing

algorithm

Page 7: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-7

Link Layer Services

Reliable delivery between adjacent nodes we learned how to do this already (chapter

3)!• Q: why both link-level and end-end

reliability?

Page 8: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-8

Link Layer Services (more)

Flow Control (Chap 3): 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

Page 9: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-9

Chapter 5 outline

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Ethernet

5.5 Hubs, bridges, and switches

5.6 Wireless links and LANs

Page 10: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-10

Error DetectionEDC= 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

Page 11: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-11

Internet checksum

Sender: treat segment contents

as sequence of 16-bit integers

checksum: addition (1’s complement sum) of segment contents

sender puts checksum value into UDP checksum field

Receiver: compute checksum of

received segment check if computed checksum

equals checksum field value: NO - error detected YES - no error detected.

But maybe errors nonetheless?

Goal: detect “errors” (e.g., flipped bits) in transmitted segment (note: used at transport layer only)

Page 12: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-12

Example of checksum - RecallSegments

0110011001100110 0101010101010101+= 1011101110111011

0100010001000100 1’s complement

Page 13: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-13

Parity Checking

Single Bit Parity:Detect single bit errors

Two Dimensional Bit Parity:Detect and correct single bit errors

0 0

Page 14: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-14

Chapter 5 outline

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Ethernet

5.5 Hubs, bridges, and switches

5.6 Wireless links and LANs

Page 15: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-15

Multiple Access Links and Protocols

Two types of “links”: point-to-point

PPP for dial-up access point-to-point link between Ethernet switch and host

broadcast (shared wire or medium) traditional Ethernet Satellite 802.11 wireless LAN

Or lecture room

Page 16: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-16

Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by

nodes: interference only one node can send successfully at a time

multiple access protocol algorithm that determines how nodes share

channel, i.e., determine when node can transmit

communication about channel sharing must use channel itself!

what to look for in multiple access protocols:

Page 17: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-17

Ideal Mulitple Access Protocol

Broadcast channel of rate R bps1. When one node wants to transmit, it can send

at rate R.2. When M nodes want to transmit, each can

send at average rate R/M3. Fully decentralized:

no special node to coordinate transmissions no synchronization of clocks, slots

4. Simple

Page 18: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-18

MAC Protocols: a taxonomy

Three broad classes: Channel Partitioning

divide channel into smaller “pieces” (time slots, frequency, code)

allocate piece to node for exclusive use

Random Access channel not divided, allow collisions “recover” from collisions

“Taking turns” speak only if “token” is at hand tightly coordinate shared access to avoid collisions

Page 19: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-19

Channel Partitioning MAC protocols: TDMA

TDMA: time division multiple access access to channel in "rounds" each station gets fixed length slot (length = pkt

trans time) in each round example: 6-station LAN, 1,3,4 have pkt, slots

2,5,6 idle

Problem unused slots go idle More ?

1 3 4 1 3 4

6-slotframe

6-slotframe

Page 20: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-20

Channel Partitioning MAC protocols: FDMA

FDMA: frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band example: 6-station LAN, 1,3,4 have pkt, frequency bands

2,5,6 idle

Problem unused transmission time in frequency bands go idle More ?

freq

uenc

y ba

nds

time

FDM cable

Page 21: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-21

Channel Partitioning (CDMA)

CDMA (Code Division Multiple Access) Analogy

Public Key Encryption• Only the one holing the key can decrypt

MotivationSender – Mix information encoded with

“codes” of receiversReceiver – Decode mixed information

using its own code, and find that for itself

Page 22: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-22

Channel Partitioning (CDMA)

CDMA (Code Division Multiple Access) used mostly in wireless broadcast channels (cellular,

satellite, etc) unique “code” assigned to each user; i.e., code set

partitioning all users share same frequency, but each user has own

“chipping” sequence (i.e., code) to encode data encoded signal = (original data) X (chipping sequence) decoding: inner-product of encoded signal and chipping

sequence allows multiple users to “coexist” and transmit

simultaneously with minimal interference (if codes are “orthogonal”)

Page 23: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-23

CDMA Encode/Decode

Page 24: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-24

CDMA: two-sender interference

Page 25: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-25

CDMA: two-sender interferenceAssume codes

(1,-1) for recv1

(1,1) for recv2

Data bit 1 for recv 1:

1·(1,-1)

Decoded using code for recv1:

1·(1,-1) ·(1,-1)

=(1,-1) ·(1,-1)=2

Decoded using code for recv 2: 1·(1,-1) ·(1,1)=(1,-1) ·(1,1)=0

Page 26: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

Frequency Hopping (origin of CDMA) Frequency Hopping Spread Spectrum: transmitting radio signal by rapidly switching among many frequency channels, using a sequence known to both transmitter and receiver

5: DataLink Layer 5a-26Google “Mother of CDMA”

Page 27: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-27

Random Access Protocols

When node has 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 collisions how to recover from collisions (e.g., via delayed

retransmissions)

Examples of random access MAC protocols: slotted ALOHA ALOHA CSMA, CSMA/CD (Ethernet), CSMA/CA (802.11 WLAN or

Wi-Fi)

Page 28: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-28

Slotted ALOHA

Assumptions all frames same size time is divided into

equal size slots, time to transmit 1 frame

nodes start to transmit frames only at beginning of slots

nodes are synchronized if 2 or more nodes

transmit in slot, all nodes detect collision

Operation when node obtains fresh

frame, it transmits in next slot

no collision, node can send new frame in next slot

if collision, node retransmits frame in each subsequent slot with prob. p until success

Page 29: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-29

Slotted ALOHA

Pros single active node can

continuously transmit at full rate of channel

highly decentralized: only slots in nodes need to be in sync

simple

Cons collisions, wasting slots idle slots nodes may be able to

detect collision in less than time to transmit packet – but sill waste a slot

clock

1 1 1 1

2

3

2 2

3 3

node 1

node 2

node 3

C C CS S SE E E

Page 30: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-30

Slotted Aloha efficiency

Suppose a node transmits a frame in a slot with probability p

prob that a node has success in a slot = p(1-p)N-1

prob that any node has a success = 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

Efficiency: long-run fraction of successful slots (many nodes, each with many frames to send)

At best: channelused for useful transmissions 37%of time!

Page 31: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-31

CSMA (Carrier Sense Multiple Access)

CSMA: listen before transmit: If channel sensed idle: transmit entire frame If channel sensed busy, defer transmission

No time slot – fully distributed Human analogy: listen and don’t interrupt others

Seems perfect – no collision !

Page 32: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-32

CSMA collisions

collisions can still occur:propagation delay means two nodes may not heareach other’s transmissioncollision:entire packet transmission time wasted

spatial layout of nodes

note:role of distance & propagation delay in determining collision probability

Page 33: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-33

CSMA collisions

collisions can still occur:propagation delay means two nodes may not heareach other’s transmissioncollision:entire packet transmission time wastednote:role of distance & propagation delay in determining collision probability

spatial layout of nodes

Page 34: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-34

CSMA/CD (Collision Detection)CSMA/CD: carrier sensing, deferral as in CSMA

collisions detected within short time colliding transmissions aborted, reducing channel

wastage collision detection:

easy in wired LANs: measure signal strengths, compare transmitted, received signals

difficult in wireless LANs: receiver shut off while transmitting

human analogy: the polite conversationalist

Page 35: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-35

CSMA/CD collision detection

Page 36: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-36

“ Taking Turns” MAC protocolschannel partitioning MAC protocols:

share channel efficiently and fairly at high load

inefficient at low load: delay in channel access, 1/N bandwidth allocated even if only 1 active node!

Random access MAC protocols efficient at low load: single node can fully

utilize channel high load: collision overhead

“taking turns” protocolslook for best of both worlds! – but practically not

Page 37: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-37

“ Taking Turns” MAC protocolsType 1: Polling: master node

“invites” slave nodes to transmit in turn Ask round-robin: do

you have frame to send ? (e.g., USB polling)

concerns: polling overhead latency single point of failure

(master)

master

slaves

poll

data

data

Page 38: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-38

“ Taking Turns” MAC protocolsType 2: Token passing: control token passed

from one node to next sequentially.

token message concerns:

token overhead latency single point of failure

(token)

T

data

(nothingto send)

T

Page 39: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5a-39

Case Study: Cable Access Network multiple 40Mbps downstream (broadcast)

channels single CMTS transmits into channels

multiple 30 Mbps upstream channels multiple access: all users contend for certain

upstream channel time slots (others assigned)

cable headend

CMTS

ISP

cable modemtermination system

cablemodem

splitter

Internet frames,TV channels, control transmitted downstream at different frequencies

upstream Internet frames, TV control, transmitted upstream at different frequencies in time slots

Page 40: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-40

Case Study: Cable Access Network DOCSIS: data over cable service interface spec

FDM over upstream, downstream frequency channels TDM upstream: some slots assigned, some have

contention• downstream MAP frame: assigns upstream slots• request for upstream slots (and data) transmitted

random access (binary backoff) in selected slots

MAP frame forInterval [t1, t2]

Residences with cable modems

Downstream channel i

Upstream channel j

t1 t2

Assigned minislots containing cable modemupstream data frames

Minislots containing minislots request frames

cable headend

CMTS

Page 41: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-41

Chapter 5 outline

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Ethernet

5.5 Hubs, bridges, and switches

5.6 Wireless links and LANs

Page 42: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-42

Ethernet

“ dominant” LAN technology: cheap $20 for 100Mbs! first widely used LAN technology Simpler, cheaper than competitors Kept up with speed race: 10, 100, 1000 Mbps …

Metcalfe’s Ethernetsketch

Page 43: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-43

Ethernet uses CSMA/CD

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, collision detection

Before attempting a retransmission, adapter waits a random time, that is, random access

Page 44: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-44

Ethernet Technologies: 10Base2 10: 10Mbps; 2: under 200 meters max cable length thin coaxial cable in a bus topology

repeaters used to connect up to multiple segments repeater repeats bits it hears on one interface to its other interfaces: physical layer device only! has become a legacy technology (mid 90s and earlier)

Page 45: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-45

10BaseT and 100BaseT 10/100 Mbps rate; latter called “fast ethernet”

Now toward gigabit

T stands for Twisted Pair Nodes connect to a switch: “star topology”

Link Layer 5-45

switch

bus: coaxial cablestar

Page 46: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-46

Manchester encoding

Used in 10BaseT, 10Base2 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!

Page 47: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-47

Chapter 5 outline

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Ethernet

5.5 Hubs and switches 5.6 Wireless links and

LANs

Page 48: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-48

Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large

collision domain Can’t interconnect 10BaseT & 100BaseT

hub

hubhub

hub

Page 49: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-49

Switch hosts have dedicated, direct

connection to switch switches buffer packets Ethernet protocol used on

each incoming link, but no collisions; full duplex each link is its own

collision domain switching: A-to-A’ and B-to-B

’ can transmit simultaneously, without collisions

switch with six interfaces(1,2,3,4,5,6)

A

A’

B

B’ C

C’

1 2

345

6

Page 50: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-50

Switch Link layer device

stores and forwards Ethernet frames examines frame header and selectively forwards

frame based on MAC dest address when frame is to be forwarded on segment, uses

CSMA/CD to access segment transparent

hosts are unaware of presence of switches plug-and-play, self-learning

switches do not need to be configured

Page 51: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-51

Forwarding

Q: how does switch know A’ reachable via interface 4, B’ reachable via interface 5?

switch with six interfaces(1,2,3,4,5,6)

A

A’

B

B’ C

C’

1 2

345

6

Q: how are entries created, maintained in switch table?

something like a routing protocol?

A: each switch has a switch table, each entry: (MAC address of host,

interface to reach host, time stamp)

looks like a routing table!

Page 52: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-52

Self learning

A switch has a switch (forwarding) table

switch learns which hosts can be reached through which interfaces when frame received, switch “learns” location of

sender: incoming LAN segment records sender/location pair in switch table

MAC addr interface TTL

Switch table (initially empty)

A 1 60

Page 53: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-53

Filtering/ForwardingWhen switch receives a frame:

index switch table using MAC dest addressif entry found for destination

then{ if dest 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

Page 54: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-54

Switch example

Suppose C sends frame to D

Switch receives frame from C notes in switch table that C is on interface 1 because D is not in table, switch forwards frame into

interfaces 2 and 3

frame received by D

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEG

1123

12 3

Page 55: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-55

Switch example

Suppose D replies back with frame to C.

Switch receives frame from from D notes in switch table that D is on interface 2 because C is in table, switch forwards frame only to

interface 1

frame received by C

hub

hub hub

switch

A

B CD

EF

G H

I

address interface

ABEGC

11231

Page 56: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-56

Switch: traffic isolation switch installation breaks subnet into LAN

segments switch filters packets:

same-LAN-segment frames not usually forwarded onto other LAN segments

segments become separate collision domains

hub hub hub

switch

collision domain collision domain

collision domain

Page 57: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-57

Institutional network

hub

hubhub

switch

to externalnetwork

router

IP subnet

mail server

web server

Page 58: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-58

Summary comparison

hubs routers switches

traffi c isolation

no yes yes

plug & play yes no yes

optimal routing

no yes no

cut through

yes no yes

Page 59: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-59

Chapter 5 outline

5.1 Introduction and services

5.2 Error detection and correction

5.3Multiple access protocols

5.4 Ethernet

5.5 Hubs, bridges, and switches

5.6 Wireless links and LANs

Page 60: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-60

IEEE 802.11 Wireless LAN

802.11b 2.4-5 GHz unlicensed

radio spectrum up to 11 Mbps direct sequence

spread spectrum (DSSS) in physical layer

• all hosts use same chipping code

All use CSMA/CA for multiple access All have base-station and ad-hoc network

versions

802.11a 5-6 GHz range up to 54 Mbps

802.11g 2.4-5 GHz range up to 54 Mbps

802.11n (2009) 2.4/5GHz, MIMO

Page 61: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-61

Base station approach Wireless host communicates with a base

station base station = access point (AP)

Basic Service Set (BSS) (a.k.a. “cell”) contains: wireless hosts access point (AP): base station

Page 62: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-62

Ad Hoc Network approach

No AP (i.e., base station) wireless hosts communicate with each other

to get packet from wireless host A to B may need to route through wireless hosts X,Y,Z

Applications: “laptop” meeting in conference room, car interconnection of “personal” devices battlefield

IETF MANET (Mobile Ad hoc Networks) working group

Page 63: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-63

IEEE 802.11: multiple access

Collision if 2 or more nodes transmit at same time

CSMA makes sense: get all the bandwidth if you’re the only one transmitting try to avoid collision if you sense another transmission

Page 64: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-64

Enhancement: CSMA/CD ?

Collision detection doesn’t work: hidden terminal problem

Page 65: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-65

Collision avoidance mechanisms Problem:

two nodes, hidden from each other, transmit complete frames to base station

wasted bandwidth for long duration !

Solution: small reservation packets nodes track reservation interval with internal

“network allocation vector” (NAV)

Page 66: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-66

Collision Avoidance: RTS-CTS exchange sender transmits short

RTS (request to send) packet: indicates duration of transmission

receiver replies with short CTS (clear to send) packet notifying (possibly

hidden) nodes

hidden nodes will not transmit for specified duration: NAV

Page 67: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-67

Collision Avoidance: RTS-CTS exchange

RTS and CTS short: collisions less likely, of

shorter duration end result similar to

collision detection IEEE 802.11 allows:

CSMA CSMA/CA: reservations polling from AP

Page 68: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-68

A word about Bluetooth

Low-power, small radius, wireless networking technology 10-100 meters

omnidirectional not line-of-sight

infrared

Interconnects gadgets 2.4-2.5 GHz

unlicensed radio band up to 721 kbps

Interference from wireless LANs, digital cordless phones, microwave ovens: frequency hopping

helps

MAC protocol supports: error correction ARQ

Each node has a 12-bit address

Page 69: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer 5a-69

Chapter 5: Summary

principles behind data link layer services: error detection, correction sharing a broadcast channel: multiple access link layer addressing, ARP

link layer technologies: Ethernet, hubs, bridges, switches,IEEE 802.11 LANs, PPP,

journey down the protocol stack now OVER! future stops: multimedia, security,

network management

Page 70: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

Link Layer

Finally: a day in the life of a web request journey down protocol stack complete!

application, transport, network, link putting-it-all-together: synthesis!

goal: identify, review, understand protocols (at all layers) involved in seemingly simple scenario: requesting www page

scenario: student attaches laptop to campus network, requests/receives www.google.com

Page 71: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

A day in the life: scenario

Comcast network 68.80.0.0/13

Google’s network 64.233.160.0/19 64.233.169.105

web server

DNS server

school network 68.80.2.0/24

web page

browser

Page 72: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

router(runs DHCP)

A day in the life… connecting to the Internet

connecting laptop needs to get its own IP address, addr of first-hop router, addr of DNS server: use DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCPDHCP

DHCP request encapsulated in UDP, encapsulated in IP, encapsulated in 802.3 Ethernet

Ethernet frame broadcast (dest: FFFFFFFFFFFF) on LAN, received at router running DHCP server Ethernet demuxed to IP demuxed, UDP demuxed to DHCP

Page 73: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

router(runs DHCP)

DHCP server formulates DHCP ACK containing client’s IP address, IP address of first-hop router for client, name & IP address of DNS server

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCPUDP

IPEthPhy

DHCP

DHCP

DHCP

DHCP

DHCP

encapsulation at DHCP server, frame forwarded (switch learning) through LAN, demultiplexing at client

Client now has IP address, knows name & addr of DNS server, IP address of its first-hop router

DHCP client receives DHCP ACK reply

A day in the life… connecting to the Internet

Page 74: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

router(runs DHCP)

A day in the life… ARP (before DNS, before HTTP)

before sending HTTP request, need IP address of www.google.com: DNS

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS query created, encapsulated in UDP, encapsulated in IP, encapsulated in Eth. To send frame to router, need MAC address of router interface: ARP

ARP query broadcast, received by router, which replies with ARP reply giving MAC address of router interface client now knows MAC address of first hop router, so can now send frame containing DNS query

ARP query

EthPhy

ARP

ARP

ARP reply

Page 75: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

router(runs DHCP)

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

DNS

IP datagram containing DNS query forwarded via LAN switch from client to 1st hop router

IP datagram forwarded from campus network into comcast network, routed (tables created by RIP, OSPF, IS-IS and/or BGP routing protocols) to DNS server demux’ed to DNS server

DNS server replies to client with IP address of www.google.com

Comcast network 68.80.0.0/13

DNS server

DNSUDP

IPEthPhy

DNS

DNS

DNS

DNS

A day in the life… using DNS

Page 76: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

router(runs DHCP)

A day in the life…TCP connection carrying HTTP

HTTPTCPIP

EthPhy

HTTP

to send HTTP request, client first opens TCP socket to web server

TCP SYN segment (step 1 in 3-way handshake) inter-domain routed to web server

TCP connection established!64.233.169.105

web server

SYN

SYN

SYN

SYN

TCPIP

EthPhy

SYN

SYN

SYN

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

SYNACK

web server responds with TCP SYNACK (step 2 in 3-way handshake)

Page 77: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

router(runs DHCP)

A day in the life… HTTP request/reply

HTTPTCPIP

EthPhy

HTTP

HTTP request sent into TCP socket

IP datagram containing HTTP request routed to www.google.com

IP datagram containing HTTP reply routed back to client64.233.169.105

web server

HTTPTCPIP

EthPhy

web server responds with HTTP reply (containing web page)

HTTP

HTTP

HTTPHTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

HTTP

web page finally (!!!) displayed

Page 78: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5a-78

Data Center Networks (some hot topics in recent years; FYI only)

10’s to 100’s of thousands of hosts, often closely coupled, in close proximity: e-business (e.g. Amazon) content-servers (e.g., YouTube, Akamai, Apple, Microsoft) search engines, data mining (e.g., Google)

Inside a 40-ft Microsoft container, Chicago data center

challenges: multiple applications, each serving

massive numbers of clients managing/balancing load, avoiding

processing, networking, data bottlenecks

Page 79: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer

Data Center Networks load balancer: application-layer

routing receives external client requests directs workload within data center returns results to external client (hiding data

center internals from client)

Server racks

TOR switches

Tier-1 switches

Tier-2 switches

Load balancer

Load balancer

B

1 2 3 4 5 6 7 8

A C

Border router

Access router

Internet

Page 80: 5: DataLink Layer 5a-1 Chapter 5 Data Link Layer CMPT 371 Data Communications and Networking.

5: DataLink Layer

Data Center Networks

rich interconnection among switches, racks: increased throughput between racks

(multiple routing paths possible) increased reliability via redundancy

Server racks

TOR switches

Tier-1 switches

Tier-2 switches

1 2 3 4 5 6 7 8