tcp/ip data link layer

60
Data Link Layer Session No.5 Data Link Layer

Upload: swapnil-kulkarni

Post on 26-Jan-2015

143 views

Category:

Software


8 download

DESCRIPTION

Computer Networking

TRANSCRIPT

Page 1: TCP/IP Data Link Layer

Data Link Layer

Session No5

Data Link Layer

Data Link Layer

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

servicesm error detection correctionm sharing a broadcast channel multiple accessm link layer addressingm reliable data transfer flow control

r instantiation and implementation of various link layer technologies

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Link Layer IntroductionSome terminologyr hosts and routers are nodesr communication channels that

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

r layer-2 packet is a frame encapsulates datagram

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

Data Link Layer

Link layer context

r datagram transferred by different link protocols over different linksm eg Ethernet on first link

frame relay on intermediate links 80211 on last link

r each link protocol provides different servicesm eg may or may not

provide rdt over link

transportation analogyr trip from Princeton to

Lausannem limo Princeton to JFKm plane JFK to Genevam train Geneva to Lausanne

r tourist = datagramr transport segment =

communication linkr transportation mode =

link layer protocolr travel agent = routing

algorithm

Data Link Layer

Link Layer Services

r framing link access m encapsulate datagram into frame adding header trailerm channel access if shared mediumm ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

r reliable delivery between adjacent nodesm we learned how to do this already m seldom used on low bit-error link (fiber some twisted

pair)m wireless links high error rates

Data Link Layer

Link Layer Services (more)

r flow control m pacing between adjacent sending and receiving nodes

r error detection m errors caused by signal attenuation noise m receiver detects presence of errors

bull signals sender for retransmission or drops frame

r error correction m receiver identifies and corrects bit error(s) without

resorting to retransmissionr half-duplex and full-duplex

m with half duplex nodes at both ends of link can transmit but not at same time

Data Link Layer

Where is the link layer implemented

r in each and every hostr link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)m Ethernet card PCMCI

card 80211 cardm implements link physical

layerr attaches into hostrsquos

system busesr combination of

hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 2: TCP/IP Data Link Layer

Data Link Layer

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

servicesm error detection correctionm sharing a broadcast channel multiple accessm link layer addressingm reliable data transfer flow control

r instantiation and implementation of various link layer technologies

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Link Layer IntroductionSome terminologyr hosts and routers are nodesr communication channels that

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

r layer-2 packet is a frame encapsulates datagram

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

Data Link Layer

Link layer context

r datagram transferred by different link protocols over different linksm eg Ethernet on first link

frame relay on intermediate links 80211 on last link

r each link protocol provides different servicesm eg may or may not

provide rdt over link

transportation analogyr trip from Princeton to

Lausannem limo Princeton to JFKm plane JFK to Genevam train Geneva to Lausanne

r tourist = datagramr transport segment =

communication linkr transportation mode =

link layer protocolr travel agent = routing

algorithm

Data Link Layer

Link Layer Services

r framing link access m encapsulate datagram into frame adding header trailerm channel access if shared mediumm ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

r reliable delivery between adjacent nodesm we learned how to do this already m seldom used on low bit-error link (fiber some twisted

pair)m wireless links high error rates

Data Link Layer

Link Layer Services (more)

r flow control m pacing between adjacent sending and receiving nodes

r error detection m errors caused by signal attenuation noise m receiver detects presence of errors

bull signals sender for retransmission or drops frame

r error correction m receiver identifies and corrects bit error(s) without

resorting to retransmissionr half-duplex and full-duplex

m with half duplex nodes at both ends of link can transmit but not at same time

Data Link Layer

Where is the link layer implemented

r in each and every hostr link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)m Ethernet card PCMCI

card 80211 cardm implements link physical

layerr attaches into hostrsquos

system busesr combination of

hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 3: TCP/IP Data Link Layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Link Layer IntroductionSome terminologyr hosts and routers are nodesr communication channels that

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

r layer-2 packet is a frame encapsulates datagram

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

Data Link Layer

Link layer context

r datagram transferred by different link protocols over different linksm eg Ethernet on first link

frame relay on intermediate links 80211 on last link

r each link protocol provides different servicesm eg may or may not

provide rdt over link

transportation analogyr trip from Princeton to

Lausannem limo Princeton to JFKm plane JFK to Genevam train Geneva to Lausanne

r tourist = datagramr transport segment =

communication linkr transportation mode =

link layer protocolr travel agent = routing

algorithm

Data Link Layer

Link Layer Services

r framing link access m encapsulate datagram into frame adding header trailerm channel access if shared mediumm ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

r reliable delivery between adjacent nodesm we learned how to do this already m seldom used on low bit-error link (fiber some twisted

pair)m wireless links high error rates

Data Link Layer

Link Layer Services (more)

r flow control m pacing between adjacent sending and receiving nodes

r error detection m errors caused by signal attenuation noise m receiver detects presence of errors

bull signals sender for retransmission or drops frame

r error correction m receiver identifies and corrects bit error(s) without

resorting to retransmissionr half-duplex and full-duplex

m with half duplex nodes at both ends of link can transmit but not at same time

Data Link Layer

Where is the link layer implemented

r in each and every hostr link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)m Ethernet card PCMCI

card 80211 cardm implements link physical

layerr attaches into hostrsquos

system busesr combination of

hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 4: TCP/IP Data Link Layer

Data Link Layer

Link Layer IntroductionSome terminologyr hosts and routers are nodesr communication channels that

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

r layer-2 packet is a frame encapsulates datagram

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

Data Link Layer

Link layer context

r datagram transferred by different link protocols over different linksm eg Ethernet on first link

frame relay on intermediate links 80211 on last link

r each link protocol provides different servicesm eg may or may not

provide rdt over link

transportation analogyr trip from Princeton to

Lausannem limo Princeton to JFKm plane JFK to Genevam train Geneva to Lausanne

r tourist = datagramr transport segment =

communication linkr transportation mode =

link layer protocolr travel agent = routing

algorithm

Data Link Layer

Link Layer Services

r framing link access m encapsulate datagram into frame adding header trailerm channel access if shared mediumm ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

r reliable delivery between adjacent nodesm we learned how to do this already m seldom used on low bit-error link (fiber some twisted

pair)m wireless links high error rates

Data Link Layer

Link Layer Services (more)

r flow control m pacing between adjacent sending and receiving nodes

r error detection m errors caused by signal attenuation noise m receiver detects presence of errors

bull signals sender for retransmission or drops frame

r error correction m receiver identifies and corrects bit error(s) without

resorting to retransmissionr half-duplex and full-duplex

m with half duplex nodes at both ends of link can transmit but not at same time

Data Link Layer

Where is the link layer implemented

r in each and every hostr link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)m Ethernet card PCMCI

card 80211 cardm implements link physical

layerr attaches into hostrsquos

system busesr combination of

hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 5: TCP/IP Data Link Layer

Data Link Layer

Link layer context

r datagram transferred by different link protocols over different linksm eg Ethernet on first link

frame relay on intermediate links 80211 on last link

r each link protocol provides different servicesm eg may or may not

provide rdt over link

transportation analogyr trip from Princeton to

Lausannem limo Princeton to JFKm plane JFK to Genevam train Geneva to Lausanne

r tourist = datagramr transport segment =

communication linkr transportation mode =

link layer protocolr travel agent = routing

algorithm

Data Link Layer

Link Layer Services

r framing link access m encapsulate datagram into frame adding header trailerm channel access if shared mediumm ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

r reliable delivery between adjacent nodesm we learned how to do this already m seldom used on low bit-error link (fiber some twisted

pair)m wireless links high error rates

Data Link Layer

Link Layer Services (more)

r flow control m pacing between adjacent sending and receiving nodes

r error detection m errors caused by signal attenuation noise m receiver detects presence of errors

bull signals sender for retransmission or drops frame

r error correction m receiver identifies and corrects bit error(s) without

resorting to retransmissionr half-duplex and full-duplex

m with half duplex nodes at both ends of link can transmit but not at same time

Data Link Layer

Where is the link layer implemented

r in each and every hostr link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)m Ethernet card PCMCI

card 80211 cardm implements link physical

layerr attaches into hostrsquos

system busesr combination of

hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 6: TCP/IP Data Link Layer

Data Link Layer

Link Layer Services

r framing link access m encapsulate datagram into frame adding header trailerm channel access if shared mediumm ldquoMACrdquo addresses used in frame headers to identify

source dest bull different from IP address

r reliable delivery between adjacent nodesm we learned how to do this already m seldom used on low bit-error link (fiber some twisted

pair)m wireless links high error rates

Data Link Layer

Link Layer Services (more)

r flow control m pacing between adjacent sending and receiving nodes

r error detection m errors caused by signal attenuation noise m receiver detects presence of errors

bull signals sender for retransmission or drops frame

r error correction m receiver identifies and corrects bit error(s) without

resorting to retransmissionr half-duplex and full-duplex

m with half duplex nodes at both ends of link can transmit but not at same time

Data Link Layer

Where is the link layer implemented

r in each and every hostr link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)m Ethernet card PCMCI

card 80211 cardm implements link physical

layerr attaches into hostrsquos

system busesr combination of

hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 7: TCP/IP Data Link Layer

Data Link Layer

Link Layer Services (more)

r flow control m pacing between adjacent sending and receiving nodes

r error detection m errors caused by signal attenuation noise m receiver detects presence of errors

bull signals sender for retransmission or drops frame

r error correction m receiver identifies and corrects bit error(s) without

resorting to retransmissionr half-duplex and full-duplex

m with half duplex nodes at both ends of link can transmit but not at same time

Data Link Layer

Where is the link layer implemented

r in each and every hostr link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)m Ethernet card PCMCI

card 80211 cardm implements link physical

layerr attaches into hostrsquos

system busesr combination of

hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 8: TCP/IP Data Link Layer

Data Link Layer

Where is the link layer implemented

r in each and every hostr link layer implemented in

ldquoadaptorrdquo (aka network interface card NIC)m Ethernet card PCMCI

card 80211 cardm implements link physical

layerr attaches into hostrsquos

system busesr combination of

hardware software firmware

controller

physicaltransmission

cpu memory

host bus (eg PCI)

network adaptercard

host schematic

applicationtransportnetwork

link

linkphysical

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 9: TCP/IP Data Link Layer

Data Link Layer

Adaptors Communicating

r sending sidem encapsulates datagram in

framem adds error checking bits

rdt flow control etc

r receiving sidem looks for errors rdt flow

control etcm extracts datagram passes

to upper layer at receiving side

controller

controller

sending host receiving host

datagram datagram

datagram

frame

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 10: TCP/IP Data Link Layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 11: TCP/IP Data Link Layer

Data Link Layer

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

bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction

otherwise

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 12: TCP/IP Data Link Layer

Data Link Layer

Parity Checking

Single Bit ParityDetect single bit errors

Two Dimensional Bit ParityDetect and correct single bit errors

0 0

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 13: TCP/IP Data Link Layer

Data Link Layer

Internet checksum (review)

Senderr treat segment contents as

sequence of 16-bit integers

r checksum addition (1rsquos complement sum) of segment contents

r sender puts checksum value into UDP checksum field

Receiverr compute checksum of

received segmentr check if computed checksum

equals checksum field valuem NO - error detectedm YES - no error detected

But maybe errors nonetheless

Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 14: TCP/IP Data Link Layer

Data Link Layer

Checksumming Cyclic Redundancy Check

r view data bits D as a binary numberr choose r+1 bit pattern (generator) G r goal choose r CRC bits R such that

m ltDRgt exactly divisible by G (modulo 2) m receiver knows G divides ltDRgt by G If non-zero remainder

error detectedm can detect all burst errors less than r+1 bits

r widely used in practice (Ethernet 80211 WiFi ATM)

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 15: TCP/IP Data Link Layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernet

r 56 Link-layer switchesr 57 PPPr 58 Link Virtualization

ATM MPLS

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 16: TCP/IP Data Link Layer

Data Link Layer

Multiple Access Links and Protocols

Two types of ldquolinksrdquor point-to-point

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

r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 80211 wireless LAN

shared wire (eg cabled Ethernet)

shared RF (eg 80211 WiFi)

shared RF(satellite)

humans at acocktail party

(shared air acoustical)

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 17: TCP/IP Data Link Layer

Data Link Layer

Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes

interference m collision if node receives two or more signals at the same time

multiple access protocolr distributed algorithm that determines how nodes

share channel ie determine when node can transmitr communication about channel sharing must use channel

itself m no out-of-band channel for coordination

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 18: TCP/IP Data Link Layer

Data Link Layer

MAC Protocols a taxonomy

Three broad classesr Channel Partitioning

m divide channel into smaller ldquopiecesrdquo (time slots frequency code)

m allocate piece to node for exclusive user Random Access

m channel not divided allow collisionsm ldquorecoverrdquo from collisions

r ldquoTaking turnsrdquom nodes take turns but nodes with more to send can take

longer turns

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 19: TCP/IP Data Link Layer

Data Link Layer

Channel Partitioning MAC protocols TDMA

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

trans time) in each round r unused slots go idle r example 6-station LAN 134 have pkt slots 256

idle

1 3 4 1 3 4

6-slotframe

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 20: TCP/IP Data Link Layer

Data Link Layer

Channel Partitioning MAC protocols FDMA

FDMA frequency division multiple access r channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example 6-station LAN 134 have pkt frequency

bands 256 idle

freq

uenc

y ba

nds

time

FDM cable

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 21: TCP/IP Data Link Layer

Data Link Layer

Random Access Protocols

r When node has packet to sendm transmit at full channel data rate Rm no a priori coordination among nodes

r two or more transmitting nodes ldquocollisionrdquor random access MAC protocol specifies

m how to detect collisionsm how to recover from collisions (eg via delayed

retransmissions)r Examples of random access MAC protocols

m slotted ALOHAm ALOHAm CSMA CSMACD CSMACA

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 22: TCP/IP Data Link Layer

Data Link Layer

Slotted ALOHA

Assumptionsr all frames same sizer time divided into equal

size slots (time to transmit 1 frame)

r nodes start to transmit only slot beginning

r nodes are synchronizedr if 2 or more nodes

transmit in slot all nodes detect collision

Operationr when node obtains fresh

frame transmits in next slotm if no collision node can

send new frame in next slot

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

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 23: TCP/IP Data Link Layer

Data Link Layer

Slotted ALOHA

Prosr single active node can

continuously transmit at full rate of channel

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

r simple

Consr collisions wasting slotsr idle slotsr nodes may be able to

detect collision in less than time to transmit packet

r clock synchronization

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 24: TCP/IP Data Link Layer

Data Link Layer

Pure (unslotted) ALOHAr unslotted Aloha simpler no synchronizationr when frame first arrives

m transmit immediately r collision probability increases

m frame sent at t0 collides with other frames sent in [t0-1t0+1]

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 25: TCP/IP Data Link Layer

Data Link Layer

CSMA (Carrier Sense Multiple Access)

CSMA listen before transmitIf channel sensed idle transmit entire framer If channel sensed busy defer transmission

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 26: TCP/IP Data Link Layer

Data Link Layer

CSMA collisions

collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmission

collisionentire packet transmission time wasted

spatial layout of nodes

noterole of distance amp propagation delay in determining collision probability

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 27: TCP/IP Data Link Layer

Data Link Layer

CSMACD (Collision Detection)

CSMACD carrier sensing deferral as in CSMAm collisions detected within short timem colliding transmissions aborted reducing channel

wastage r collision detection

m easy in wired LANs measure signal strengths compare transmitted received signals

m difficult in wireless LANs received signal strength overwhelmed by local transmission strength

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 28: TCP/IP Data Link Layer

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

channel partitioning MAC protocolsm share channel efficiently and fairly at high loadm inefficient at low load delay in channel access

1N bandwidth allocated even if only 1 active node

Random access MAC protocolsm efficient at low load single node can fully

utilize channelm high load collision overhead

ldquotaking turnsrdquo protocolslook for best of both worlds

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 29: TCP/IP Data Link Layer

Data Link Layer

ldquoTaking Turnsrdquo MAC protocols

Polling r master node

ldquoinvitesrdquo slave nodes to transmit in turn

r typically used with ldquodumbrdquo slave devices

r concernsm polling overhead m latencym single point of

failure (master)

master

slaves

poll

data

data

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 30: TCP/IP Data Link Layer

Data Link Layer

ldquoTaking Turnsrdquo MAC protocolsToken passingr control token passed

from one node to next sequentially

r token messager concerns

m token overhead m latencym single point of failure

(token)

T

data

(nothingto send)

T

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 31: TCP/IP Data Link Layer

Data Link Layer

Summary of MAC protocols

r channel partitioning by time frequency or codem Time Division Frequency Division

r random access (dynamic) m ALOHA S-ALOHA CSMA CSMACDm carrier sensing easy in some technologies (wire) hard in

others (wireless)m CSMACD used in Ethernetm CSMACA used in 80211

r taking turnsm polling from central site token passingm Bluetooth FDDI IBM Token Ring

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 32: TCP/IP Data Link Layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 33: TCP/IP Data Link Layer

Data Link Layer

MAC Addresses and ARP

r 32-bit IP address m network-layer addressm used to get datagram to destination IP subnet

r MAC (or LAN or physical or Ethernet) address m function get frame from one interface to another

physically-connected interface (same network)m 48 bit MAC address (for most LANs)

bull burned in NIC ROM also sometimes software settable

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 34: TCP/IP Data Link Layer

Data Link Layer

LAN Addresses and ARPEach adapter on LAN has unique LAN address

Broadcast address =FF-FF-FF-FF-FF-FF

= adapter

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN(wired orwireless)

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 35: TCP/IP Data Link Layer

Data Link Layer

LAN Address (more)

r MAC address allocation administered by IEEEr manufacturer buys portion of MAC address space

(to assure uniqueness)r MAC flat address portability

m can move LAN card from one LAN to anotherr IP hierarchical address NOT portable

m address depends on IP subnet to which node is attached

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 36: TCP/IP Data Link Layer

Data Link Layer

ARP Address Resolution Protocol

r Each IP node (host router) on LAN has ARP table

r ARP table IPMAC address mappings for some LAN nodes

lt IP address MAC address TTLgtm TTL (Time To Live) time

after which address mapping will be forgotten (typically 20 min)

Question how to determineMAC address of Bknowing Brsquos IP address

1A-2F-BB-76-09-AD

58-23-D7-FA-20-B0

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

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

LAN

137196723

137196778

137196714

137196788

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 37: TCP/IP Data Link Layer

Data Link Layer

ARP protocol Same LAN (network)

r A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table

r A broadcasts ARP query packet containing Bs IP address m dest MAC address = FF-

FF-FF-FF-FF-FFm all machines on LAN

receive ARP query r B receives ARP packet

replies to A with its (Bs) MAC addressm frame sent to Arsquos MAC

address (unicast)

r A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) m soft state information

that times out (goes away) unless refreshed

r ARP is ldquoplug-and-playrdquom nodes create their ARP

tables without intervention from net administrator

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 38: TCP/IP Data Link Layer

Data Link Layer

Addressing routing to another LAN

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

walkthrough send datagram from A to B via R assume A knows Brsquos IP address

r two ARP tables in router R one for each IP network (LAN)

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 39: TCP/IP Data Link Layer

Data Link Layer

r A creates IP datagram with source A destination B r A uses ARP to get Rrsquos MAC address for 111111111110r A creates link-layer frame with Rs MAC address as dest

frame contains A-to-B IP datagramr Arsquos NIC sends frame r Rrsquos NIC receives frame r R removes IP datagram from Ethernet frame sees its

destined to Br R uses ARP to get Brsquos MAC address r R creates frame containing A-to-B IP datagram sends to B

R

1A-23-F9-CD-06-9B

222222222220111111111110

E6-E9-00-17-BB-4B

CC-49-DE-D0-AB-7D

111111111112

111111111111

A74-29-9C-E8-FF-55

222222222221

88-B2-2F-54-1A-0F

B222222222222

49-BD-D2-C7-56-2A

This is a really importantexample ndash make sure youunderstand

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 40: TCP/IP Data Link Layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53Multiple access protocols

r 54 Link-Layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 41: TCP/IP Data Link Layer

Data Link Layer

Ethernetldquodominantrdquo wired LAN technology r cheap $20 for NICr first widely used LAN technologyr simpler cheaper than token LANs and ATMr kept up with speed race 10 Mbps ndash 10 Gbps

Metcalfersquos Ethernetsketch

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 42: TCP/IP Data Link Layer

Data Link Layer

Star topologyr bus topology popular through mid 90s

m all nodes in same collision domain (can collide with each other)

r today star topology prevailsm active switch in centerm each ldquospokerdquo runs a (separate) Ethernet protocol (nodes

do not collide with each other)

switch

bus coaxial cable star

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 43: TCP/IP Data Link Layer

Data Link Layer

Ethernet Frame Structure

Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame

Preamble r 7 bytes with pattern 10101010 followed by one

byte with pattern 10101011r used to synchronize receiver sender clock rates

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 44: TCP/IP Data Link Layer

Data Link Layer

Ethernet Frame Structure (more)r Addresses 6 bytes

m if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocol

m otherwise adapter discards framer Type indicates higher layer protocol (mostly IP

but others possible eg Novell IPX AppleTalk)r CRC checked at receiver if error is detected

frame is dropped

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 45: TCP/IP Data Link Layer

Data Link Layer

Ethernet Unreliable connectionless

r connectionless No handshaking between sending and receiving NICs

r unreliable receiving NIC doesnrsquot send acks or nacks to sending NICm stream of datagrams passed to network layer can have gaps

(missing datagrams)m gaps will be filled if app is using TCPm otherwise app will see gaps

r Ethernetrsquos MAC protocol unslotted CSMACD

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 46: TCP/IP Data Link Layer

Data Link Layer

Ethernet CSMACD algorithm

1 NIC receives datagram from network layer creates frame

2 If NIC senses channel idle starts frame transmission If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

4 If NIC detects another transmission while transmitting aborts and sends jam signal

5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 47: TCP/IP Data Link Layer

Data Link Layer

Ethernetrsquos CSMACD (more)Jam Signal make sure all

other transmitters are aware of collision 48 bits

Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec

Exponential Backoff r Goal adapt retransmission

attempts to estimated current loadm heavy load random wait

will be longerr first collision choose K from

01 delay is K 512 bit transmission times

r after second collision choose K from 0123hellip

r after ten collisions choose K from 01234hellip1023

Seeinteract with Javaapplet on AWL Web sitehighly recommended

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 48: TCP/IP Data Link Layer

Data Link Layer

8023 Ethernet Standards Link amp Physical Layers

r many different Ethernet standardsm common MAC protocol and frame formatm different speeds 2 Mbps 10 Mbps 100 Mbps

1Gbps 10G bpsm different physical layer media fiber cable

applicationtransportnetwork

linkphysical

MAC protocoland frame format

100BASE-TX

100BASE-T4

100BASE-FX100BASE-T2

100BASE-SX 100BASE-BX

fiber physical layercopper (twisterpair) physical layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 49: TCP/IP Data Link Layer

Data Link Layer

Link Layer

r 51 Introduction and services

r 52 Error detection and correction

r 53 Multiple access protocols

r 54 Link-layer Addressing

r 55 Ethernetr 56 Link-layer switches

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 50: TCP/IP Data Link Layer

Data Link Layer

Hubshellip physical-layer (ldquodumbrdquo) repeaters

m bits coming in one link go out all other links at same rate

m all nodes connected to hub can collide with one another

m no frame bufferingm no CSMACD at hub host NICs detect

collisions

twisted pair

hub

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 51: TCP/IP Data Link Layer

Data Link Layer

Switch

r link-layer device smarter than hubs take active rolem store forward Ethernet framesm examine incoming framersquos MAC address

selectively forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment

r transparentm hosts are unaware of presence of switches

r plug-and-play self-learningm switches do not need to be configured

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 52: TCP/IP Data Link Layer

Data Link Layer

Switch allows multiple simultaneous transmissions

r hosts have dedicated direct connection to switch

r switches buffer packetsr Ethernet protocol used on

each incoming link but no collisions full duplexm each link is its own collision

domainr switching A-to-Arsquo and B-

to-Brsquo simultaneously without collisions m not possible with dumb hub

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 53: TCP/IP Data Link Layer

Data Link Layer

Switch Table

r Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5

r A each switch has a switch table each entrym (MAC address of host interface

to reach host time stamp)r looks like a routing tabler Q how are entries created

maintained in switch table m something like a routing

protocol

A

Arsquo

B

Brsquo

C

Crsquo

switch with six interfaces(123456)

1 2 345

6

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 54: TCP/IP Data Link Layer

Data Link Layer

Switch self-learning

r switch learns which hosts can be reached through which interfacesm when frame received

switch ldquolearnsrdquo location of sender incoming LAN segment

m records senderlocation pair in switch table

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 55: TCP/IP Data Link Layer

Data Link Layer

Self-learning forwarding example

A

Arsquo

B

Brsquo

C

Crsquo

1 2 345

6

A Arsquo

Source ADest Arsquo

MAC addr interface TTLSwitch table

(initially empty)A 1 60

A ArsquoA ArsquoA ArsquoA ArsquoA Arsquor frame destination

unknown flood

Arsquo A

r destination A location known

Arsquo 4 60

selective send

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 56: TCP/IP Data Link Layer

Data Link Layer

Interconnecting switches

r switches can be connected together

A

B

r Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3

r A self learning (works exactly the same as in single-switch case)

S1

C D

E

FS2

S4

S3

HI

G

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 57: TCP/IP Data Link Layer

Data Link Layer

Self-learning multi-switch example

Suppose C sends frame to I I responds to C

r Q show switch tables and packet forwarding in S1 S2 S3 S4

A

B

S1

C D

E

FS2

S4

S3

HI

G

12

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 58: TCP/IP Data Link Layer

Data Link Layer

Institutional network

to externalnetwork

router

IP subnet

mail server

web server

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 59: TCP/IP Data Link Layer

Data Link Layer

Switches vs Routersr both store-and-forward devices

m routers network layer devices (examine network layer headers)

m switches are link layer devicesr routers maintain routing tables implement routing

algorithmsr switches maintain switch tables implement

filtering learning algorithms

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management

Page 60: TCP/IP Data Link Layer

Data Link Layer

Chapter 5 letrsquos take a breathr journey down protocol stack complete

(except PHY)r solid understanding of networking principles

practicer hellip could stop here hellip but lots of interesting

topicsm multimediam network management