1 Link Layer 5.1 Introduction and services 5.6 Link-layer switches services 5.2 Error detection and correction 5.3Multiple access protocols 5.4 Link-layer Addressing 5: DataLink Layer 5-1 Addressing 5.5 Ethernet Link Layer: Introduction Some terminology: hosts and routers are nodes communication channels that communication channels that connect adjacent nodes along communication path are links wired links wireless links LANs layer-2 packet is a frame, encapsulates datagram 5: DataLink Layer 5-2 data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
33
Embed
Link layeruserspages.uob.edu.bh/mangoud/mohab/EEG555_files/… · · 2016-02-1612 Slotted ALOHA Pros single active node can continuously transmit t f ll t f h l Cons collisions,
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
hosts and routers are nodescommunication channels that communication channels that connect adjacent nodes along communication path are links
wired linkswireless linksLANs
layer-2 packet is a frameencapsulates datagram
5 DataLink Layer 5-2
ncapsu at s atagram
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
2
Link layer contextdatagram transferred by different link protocols over different links
transportation analogytrip from Princeton to Lausanneover different links
eg Ethernet on first link frame relay on intermediate links 80211 on last link
each link protocol provides different
i
limo Princeton to JFKplane JFK to Genevatrain Geneva to Lausanne
tourist = datagramtransport segment = communication link
5 DataLink Layer 5-3
serviceseg may or may not provide rdt over link
transportation mode = link layer protocoltravel agent = routing algorithm
Link Layer Servicesframing link access
encapsulate datagram into frame adding header trailerchannel access if shared mediumldquoMACrdquo addresses used in frame headers to identify source dest
bull different from IP addressreliable delivery between adjacent nodes
we learned how to do this already (chapter 3)ld d l b l k (f b d
5 DataLink Layer 5-4
seldom used on low bit-error link (fiber some twisted pair)wireless links high error rates
bull Q why both link-level and end-end reliability
3
Link Layer Services (more)
flow controlpacing between adjacent sending and receiving nodespacing between adjacent sending and receiving nodes
error detectionerrors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction
5 DataLink Layer 5-5
receiver identifies and corrects bit error(s) without resorting to retransmission
half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
Where is the link layer implemented
in each and every hostlink layer implemented in y pldquoadaptorrdquo (aka network interface card NIC)
Ethernet card PCMCI card 80211 cardimplements link physical layer
tt h i t h trsquo controller
cpu memory
host bus (eg PCI)
host schematic
applicationtransportnetwork
link
linkphysical
5 DataLink Layer 5-6
attaches into hostrsquos system busescombination of hardware software firmware
physicaltransmission
network adaptercard
physical
4
Adaptors Communicating
datagram datagram
sending side receiving side
controller controller
sending host receiving hostdatagram
frame
5 DataLink Layer 5-7
sending sideencapsulates datagram in frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram passes to upper layer at receiving side
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-8
Addressing55 Ethernet
5
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
5 DataLink Layer 5-9
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
5 DataLink Layer 5-10
0 0
6
Internet checksum (review)
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detected
5 DataLink Layer 5-11
complement sum) of segment contentssender puts checksum value into UDP checksum field
YES - no error detected But maybe errors nonetheless
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such thatgoal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder error detectedcan detect all burst errors less than r+1 bits
widely used in practice (Ethernet 80211 WiFi ATM)
5 DataLink Layer 5-12
7
CRC ExampleWant
D2r XOR R = nGi l lequivalentlyD2r = nG XOR R
equivalentlyif we divide D2r by G want remainder R
5 DataLink Layer 5-13
R = remainder[ ]D2r
G
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-14
Addressing55 Ethernet
8
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP for dial-up accessf ppoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)old-fashioned Ethernetupstream HFC80211 wireless LAN
5 DataLink Layer 5-15
shared wire (eg cabled Ethernet)
shared RF(eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Multiple Access protocolssingle shared broadcast channel two or more simultaneous transmissions by nodes interference
collision if node receives two or more signals at the same timemultiple access protocol
distributed algorithm that determines how nodes share channel ie determine when node can transmitcommunication about channel sharing must use channel
5 DataLink Layer 5-16
communication about channel sharing must use channel itself
no out-of-band channel for coordination
9
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
Link layer contextdatagram transferred by different link protocols over different links
transportation analogytrip from Princeton to Lausanneover different links
eg Ethernet on first link frame relay on intermediate links 80211 on last link
each link protocol provides different
i
limo Princeton to JFKplane JFK to Genevatrain Geneva to Lausanne
tourist = datagramtransport segment = communication link
5 DataLink Layer 5-3
serviceseg may or may not provide rdt over link
transportation mode = link layer protocoltravel agent = routing algorithm
Link Layer Servicesframing link access
encapsulate datagram into frame adding header trailerchannel access if shared mediumldquoMACrdquo addresses used in frame headers to identify source dest
bull different from IP addressreliable delivery between adjacent nodes
we learned how to do this already (chapter 3)ld d l b l k (f b d
5 DataLink Layer 5-4
seldom used on low bit-error link (fiber some twisted pair)wireless links high error rates
bull Q why both link-level and end-end reliability
3
Link Layer Services (more)
flow controlpacing between adjacent sending and receiving nodespacing between adjacent sending and receiving nodes
error detectionerrors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction
5 DataLink Layer 5-5
receiver identifies and corrects bit error(s) without resorting to retransmission
half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
Where is the link layer implemented
in each and every hostlink layer implemented in y pldquoadaptorrdquo (aka network interface card NIC)
Ethernet card PCMCI card 80211 cardimplements link physical layer
tt h i t h trsquo controller
cpu memory
host bus (eg PCI)
host schematic
applicationtransportnetwork
link
linkphysical
5 DataLink Layer 5-6
attaches into hostrsquos system busescombination of hardware software firmware
physicaltransmission
network adaptercard
physical
4
Adaptors Communicating
datagram datagram
sending side receiving side
controller controller
sending host receiving hostdatagram
frame
5 DataLink Layer 5-7
sending sideencapsulates datagram in frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram passes to upper layer at receiving side
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-8
Addressing55 Ethernet
5
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
5 DataLink Layer 5-9
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
5 DataLink Layer 5-10
0 0
6
Internet checksum (review)
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detected
5 DataLink Layer 5-11
complement sum) of segment contentssender puts checksum value into UDP checksum field
YES - no error detected But maybe errors nonetheless
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such thatgoal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder error detectedcan detect all burst errors less than r+1 bits
widely used in practice (Ethernet 80211 WiFi ATM)
5 DataLink Layer 5-12
7
CRC ExampleWant
D2r XOR R = nGi l lequivalentlyD2r = nG XOR R
equivalentlyif we divide D2r by G want remainder R
5 DataLink Layer 5-13
R = remainder[ ]D2r
G
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-14
Addressing55 Ethernet
8
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP for dial-up accessf ppoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)old-fashioned Ethernetupstream HFC80211 wireless LAN
5 DataLink Layer 5-15
shared wire (eg cabled Ethernet)
shared RF(eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Multiple Access protocolssingle shared broadcast channel two or more simultaneous transmissions by nodes interference
collision if node receives two or more signals at the same timemultiple access protocol
distributed algorithm that determines how nodes share channel ie determine when node can transmitcommunication about channel sharing must use channel
5 DataLink Layer 5-16
communication about channel sharing must use channel itself
no out-of-band channel for coordination
9
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
flow controlpacing between adjacent sending and receiving nodespacing between adjacent sending and receiving nodes
error detectionerrors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction
5 DataLink Layer 5-5
receiver identifies and corrects bit error(s) without resorting to retransmission
half-duplex and full-duplexwith half duplex nodes at both ends of link can transmit but not at same time
Where is the link layer implemented
in each and every hostlink layer implemented in y pldquoadaptorrdquo (aka network interface card NIC)
Ethernet card PCMCI card 80211 cardimplements link physical layer
tt h i t h trsquo controller
cpu memory
host bus (eg PCI)
host schematic
applicationtransportnetwork
link
linkphysical
5 DataLink Layer 5-6
attaches into hostrsquos system busescombination of hardware software firmware
physicaltransmission
network adaptercard
physical
4
Adaptors Communicating
datagram datagram
sending side receiving side
controller controller
sending host receiving hostdatagram
frame
5 DataLink Layer 5-7
sending sideencapsulates datagram in frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram passes to upper layer at receiving side
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-8
Addressing55 Ethernet
5
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
5 DataLink Layer 5-9
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
5 DataLink Layer 5-10
0 0
6
Internet checksum (review)
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detected
5 DataLink Layer 5-11
complement sum) of segment contentssender puts checksum value into UDP checksum field
YES - no error detected But maybe errors nonetheless
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such thatgoal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder error detectedcan detect all burst errors less than r+1 bits
widely used in practice (Ethernet 80211 WiFi ATM)
5 DataLink Layer 5-12
7
CRC ExampleWant
D2r XOR R = nGi l lequivalentlyD2r = nG XOR R
equivalentlyif we divide D2r by G want remainder R
5 DataLink Layer 5-13
R = remainder[ ]D2r
G
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-14
Addressing55 Ethernet
8
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP for dial-up accessf ppoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)old-fashioned Ethernetupstream HFC80211 wireless LAN
5 DataLink Layer 5-15
shared wire (eg cabled Ethernet)
shared RF(eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Multiple Access protocolssingle shared broadcast channel two or more simultaneous transmissions by nodes interference
collision if node receives two or more signals at the same timemultiple access protocol
distributed algorithm that determines how nodes share channel ie determine when node can transmitcommunication about channel sharing must use channel
5 DataLink Layer 5-16
communication about channel sharing must use channel itself
no out-of-band channel for coordination
9
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
sending sideencapsulates datagram in frameadds error checking bits rdt flow control etc
receiving sidelooks for errors rdt flow control etcextracts datagram passes to upper layer at receiving side
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-8
Addressing55 Ethernet
5
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
5 DataLink Layer 5-9
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
5 DataLink Layer 5-10
0 0
6
Internet checksum (review)
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detected
5 DataLink Layer 5-11
complement sum) of segment contentssender puts checksum value into UDP checksum field
YES - no error detected But maybe errors nonetheless
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such thatgoal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder error detectedcan detect all burst errors less than r+1 bits
widely used in practice (Ethernet 80211 WiFi ATM)
5 DataLink Layer 5-12
7
CRC ExampleWant
D2r XOR R = nGi l lequivalentlyD2r = nG XOR R
equivalentlyif we divide D2r by G want remainder R
5 DataLink Layer 5-13
R = remainder[ ]D2r
G
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-14
Addressing55 Ethernet
8
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP for dial-up accessf ppoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)old-fashioned Ethernetupstream HFC80211 wireless LAN
5 DataLink Layer 5-15
shared wire (eg cabled Ethernet)
shared RF(eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Multiple Access protocolssingle shared broadcast channel two or more simultaneous transmissions by nodes interference
collision if node receives two or more signals at the same timemultiple access protocol
distributed algorithm that determines how nodes share channel ie determine when node can transmitcommunication about channel sharing must use channel
5 DataLink Layer 5-16
communication about channel sharing must use channel itself
no out-of-band channel for coordination
9
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
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
5 DataLink Layer 5-9
Parity CheckingSingle Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
5 DataLink Layer 5-10
0 0
6
Internet checksum (review)
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detected
5 DataLink Layer 5-11
complement sum) of segment contentssender puts checksum value into UDP checksum field
YES - no error detected But maybe errors nonetheless
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such thatgoal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder error detectedcan detect all burst errors less than r+1 bits
widely used in practice (Ethernet 80211 WiFi ATM)
5 DataLink Layer 5-12
7
CRC ExampleWant
D2r XOR R = nGi l lequivalentlyD2r = nG XOR R
equivalentlyif we divide D2r by G want remainder R
5 DataLink Layer 5-13
R = remainder[ ]D2r
G
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-14
Addressing55 Ethernet
8
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP for dial-up accessf ppoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)old-fashioned Ethernetupstream HFC80211 wireless LAN
5 DataLink Layer 5-15
shared wire (eg cabled Ethernet)
shared RF(eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Multiple Access protocolssingle shared broadcast channel two or more simultaneous transmissions by nodes interference
collision if node receives two or more signals at the same timemultiple access protocol
distributed algorithm that determines how nodes share channel ie determine when node can transmitcommunication about channel sharing must use channel
5 DataLink Layer 5-16
communication about channel sharing must use channel itself
no out-of-band channel for coordination
9
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
Goal detect ldquoerrorsrdquo (eg flipped bits) in transmitted packet (note used at transport layer only)
Sendertreat segment contents as sequence of 16-bit integerschecksum addition (1rsquos complement sum) of
Receivercompute checksum of received segmentcheck if computed checksum equals checksum field value
NO - error detected
5 DataLink Layer 5-11
complement sum) of segment contentssender puts checksum value into UDP checksum field
YES - no error detected But maybe errors nonetheless
Checksumming Cyclic Redundancy Checkview data bits D as a binary numberchoose r+1 bit pattern (generator) Ggoal choose r CRC bits R such thatgoal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero remainder error detectedcan detect all burst errors less than r+1 bits
widely used in practice (Ethernet 80211 WiFi ATM)
5 DataLink Layer 5-12
7
CRC ExampleWant
D2r XOR R = nGi l lequivalentlyD2r = nG XOR R
equivalentlyif we divide D2r by G want remainder R
5 DataLink Layer 5-13
R = remainder[ ]D2r
G
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-14
Addressing55 Ethernet
8
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP for dial-up accessf ppoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)old-fashioned Ethernetupstream HFC80211 wireless LAN
5 DataLink Layer 5-15
shared wire (eg cabled Ethernet)
shared RF(eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Multiple Access protocolssingle shared broadcast channel two or more simultaneous transmissions by nodes interference
collision if node receives two or more signals at the same timemultiple access protocol
distributed algorithm that determines how nodes share channel ie determine when node can transmitcommunication about channel sharing must use channel
5 DataLink Layer 5-16
communication about channel sharing must use channel itself
no out-of-band channel for coordination
9
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
equivalentlyif we divide D2r by G want remainder R
5 DataLink Layer 5-13
R = remainder[ ]D2r
G
Link Layer
51 Introduction and services
56 Link-layer switches5 7 PPPservices
52 Error detection and correction 53Multiple access protocols54 Link-layer Addressing
57 PPP58 Link virtualization MPLS59 A day in the life of a web request
5 DataLink Layer 5-14
Addressing55 Ethernet
8
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP for dial-up accessf ppoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)old-fashioned Ethernetupstream HFC80211 wireless LAN
5 DataLink Layer 5-15
shared wire (eg cabled Ethernet)
shared RF(eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Multiple Access protocolssingle shared broadcast channel two or more simultaneous transmissions by nodes interference
collision if node receives two or more signals at the same timemultiple access protocol
distributed algorithm that determines how nodes share channel ie determine when node can transmitcommunication about channel sharing must use channel
5 DataLink Layer 5-16
communication about channel sharing must use channel itself
no out-of-band channel for coordination
9
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
Multiple Access Links and ProtocolsTwo types of ldquolinksrdquo
point-to-pointPPP for dial-up accessf ppoint-to-point link between Ethernet switch and host
broadcast (shared wire or medium)old-fashioned Ethernetupstream HFC80211 wireless LAN
5 DataLink Layer 5-15
shared wire (eg cabled Ethernet)
shared RF(eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Multiple Access protocolssingle shared broadcast channel two or more simultaneous transmissions by nodes interference
collision if node receives two or more signals at the same timemultiple access protocol
distributed algorithm that determines how nodes share channel ie determine when node can transmitcommunication about channel sharing must use channel
5 DataLink Layer 5-16
communication about channel sharing must use channel itself
no out-of-band channel for coordination
9
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
Broadcast channel of rate R bps1 when one node wants to transmit it can send at 1 when one node wants to transmit it can send at
rate R2 when M nodes want to transmit each can send at
average rate RM3 fully decentralized
no special node to coordinate transmissions h i ti f l k l t
5 DataLink Layer 5-17
no synchronization of clocks slots4 simple
MAC Protocols a taxonomyThree broad classes
Channel Partitioningdi id h l i t sm ll ldquo i srdquo (tim sl ts divide channel into smaller ldquopiecesrdquo (time slots frequency code)allocate piece to node for exclusive use
Random Accesschannel not divided allow collisionsldquorecoverrdquo from collisions
ldquoTaking turnsrdquo
5 DataLink Layer 5-18
Taking turnsnodes take turns but nodes with more to send can take longer turns
10
Channel Partitioning MAC protocols TDMA
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
TDMA time division multiple accessaccess to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
5 DataLink Layer 5-19
1 3 4 1 3 4
6-slotframe
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple accesschannel spectrum divided into frequency bandsp q yeach station assigned fixed frequency bandunused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
nds
5 DataLink Layer 5-20
freq
uenc
y ba
n
FDM cable
11
Random Access Protocols
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
When node has packet to sendtransmit at full channel data rate Rtransmit at full channel data rate Rno a priori coordination among nodes
two or more transmitting nodes ldquocollisionrdquorandom access MAC protocol specifies
how to detect collisionshow to recover from collisions (eg via delayed retransmissions)
5 DataLink Layer 5-21
retransmissions)Examples of random access MAC protocols
slotted ALOHAALOHACSMA CSMACD CSMACA
Slotted ALOHA
Assumptionsall frames same size
Operationwhen node obtains fresh all frames same size
time divided into equal size slots (time to transmit 1 frame)nodes start to transmit only slot beginning nodes are synchronized
when node obtains fresh frame transmits in next slot
if no collision node can send new frame in next slotif collision node
t it f i
5 DataLink Layer 5-22
yif 2 or more nodes transmit in slot all nodes detect collision
retransmits frame in each subsequent slot with prob p until success
12
Slotted ALOHA
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
Prossingle active node can continuously transmit t f ll t f h l
Conscollisions wasting slotsidle slots
d b bl t
5 DataLink Layer 5-23
at full rate of channelhighly decentralized only slots in nodes need to be in syncsimple
nodes may be able to detect collision in less than time to transmit packetclock synchronization
Slotted Aloha efficiencymax efficiency find p that maximizes Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many
suppose N nodes with many frames to send each transmits in slot with probability p
for many nodes take limit of Np(1-p)N-1
as N goes to infinity gives
Max efficiency = 1e = 37
y yframes to send)
5 DataLink Layer 5-24
prob that given node has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
At best channelused for useful transmissions 37of time
13
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
Pure (unslotted) ALOHAunslotted Aloha simpler no synchronizationwhen frame first arrives
transmit immediately collision probability increases
frame sent at t0 collides with other frames sent in [t0-1t0+1]
5 DataLink Layer 5-25
Pure Aloha efficiencyP(success by given node) = P(node transmits)
P(no other node transmits in [p0-1p0] p0 p0
P(no other node transmits in [p0-1p0] = p (1-p)N-1 (1-p)N-1
= p (1-p)2(N-1)
hellip choosing optimum p and then letting n -gt infty
5 DataLink Layer 5-26
= 1(2e) = 18
even worse than slotted Aloha
14
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
CSMA listen before transmitIf channel sensed idle transmit entire frame
If channel sensed busy defer transmission
human analogy donrsquot interrupt others
5 DataLink Layer 5-27
CSMA collisionscollisions can still occurpropagation delay means
spatial layout of nodes
two nodes may not heareach otherrsquos transmission
collisionentire packet transmission time wastednote
5 DataLink Layer 5-28
role of distance amp propagation delay in determining collision probability
15
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
CSMACD (Collision Detection)CSMACD carrier sensing deferral as in CSMA
collisions detected within short timemcolliding transmissions aborted reducing channel wastage
collision detectioneasy in wired LANs measure signal strengths compare transmitted received signals
5 DataLink Layer 5-29
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD collision detection
5 DataLink Layer 5-30
16
ldquoTaking Turnsrdquo MAC protocols
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
channel partitioning MAC protocolsshare channel efficiently and fairly at high loadshare channel efficiently and fairly at high loadinefficient at low load delay in channel access 1N bandwidth allocated even if only 1 active node
Random access MAC protocolsefficient at low load single node can fully
ili h l
5 DataLink Layer 5-31
utilize channelhigh load collision overhead
ldquotaking turnsrdquo protocolslook for best of both worlds
ldquoTaking Turnsrdquo MAC protocolsPolling
master node ldquoinvitesrdquo slave nodes to transmit in turntypically used with ldquodumbrdquo slave devicesconcerns
polling overhead
master
poll
data
data
5 DataLink Layer 5-32
polling overhead latencysingle point of failure (master)
slaves
17
ldquoTaking Turnsrdquo MAC protocolsToken passing
control token passed f d
T
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
from one node to next sequentiallytoken messageconcerns
token overhead latency
(nothingto send)
T
5 DataLink Layer 5-33
ysingle point of failure (token)
data
Summary of MAC protocols
channel partitioning by time frequency or codeTime Division Frequency DivisionTime Division Frequency Division
random access (dynamic) ALOHA S-ALOHA CSMA CSMACDcarrier sensing easy in some technologies (wire) hard in others (wireless)CSMACD used in EthernetCSMACA used in 80211
5 DataLink Layer 5-34
taking turnspolling from central site token passingBluetooth FDDI IBM Token Ring
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
physically-connected interface (same network)48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable
19
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
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
71 65 F7 2B 08 53
LAN(wired orwireless)
5 DataLink Layer 5-37
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN Address (more)
MAC address allocation administered by IEEEmanufacturer buys portion of MAC address space manufacturer buys portion of MAC address space (to assure uniqueness)analogy
(a) MAC address like Social Security Number(b) IP address like postal address
MAC flat address portability
5 DataLink Layer 5-38
p ycan move LAN card from one LAN to another
IP hierarchical address NOT portableaddress depends on IP subnet to which node is attached
20
ARP Address Resolution Protocol
Each IP node (host router) on LAN has
Question how to determineMAC address of B
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
ARP tableARP table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgtTTL (Time To Live) time ft hi h dd
knowing Brsquos IP address
1A-2F-BB-76-09-AD
LAN
137196723
137196778
137196714
5 DataLink Layer 5-39
after which address mapping will be forgotten (typically 20 min)58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196788
ARP protocol Same LAN (network)
A wants to send datagram to B and Brsquos MAC address not in Arsquos ARP table
A caches (saves) IP-to-MAC address pair in its
A broadcasts ARP query packet containing Bs IP address
dest MAC address = FF-FF-FF-FF-FF-FFall machines on LAN receive ARP query
ARP table until information becomes old (times out)
soft state information that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquonodes create their ARP
5 DataLink Layer 5-40
B receives ARP packet replies to A with its (Bs) MAC address
frame sent to Arsquos MAC address (unicast)
nodes create their ARP tables without intervention from net administrator
21
Addressing routing to another LAN
74-29-9C-E8-FF-55 88-B2-2F-54-1A-0F
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
walkthrough send datagram from A to B via Rassume A knows Brsquos IP address
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
111111111112
111111111111
A222222222221
B222222222222
49-BD-D2-C7-56-2A
5 DataLink Layer 5-41
CC-49-DE-D0-AB-7D
two ARP tables in router R one for each IP network (LAN)
A creates IP datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110A creates link-layer frame with Rs MAC address as dest frame contains A-to-B IP datagramArsquos NIC sends frame Rrsquos NIC receives frame
This is a really importantexample ndash make sure youunderstandR s NIC receives frame
R removes IP datagram from Ethernet frame sees its destined to BR uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
cheap $20 for NICfi t id l d LAN t h lfirst widely used LAN technologysimpler cheaper than token LANs and ATMkept up with speed race 10 Mbps ndash 10 Gbps
lf E h
5 DataLink Layer 5-44
Metcalfersquos Ethernetsketch
23
Star topologybus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
all nodes in same collision domain (can collide with each other)
today star topology prevailstoday star topology prevailsactive switch in centereach ldquospokerdquo runs a (separate) Ethernet protocol (nodes do not collide with each other)
5 DataLink Layer 5-45
switch
bus coaxial cable star
Ethernet Frame StructureSending adapter encapsulates IP datagram (or other
network layer protocol packet) in Ethernet frame
Preamble7 bytes with pattern 10101010 followed by one byte with pattern 10101011
5 DataLink Layer 5-46
byte with pattern 10101011used to synchronize receiver sender clock rates
24
Ethernet Frame Structure (more)Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it address or with broadcast address (eg ARP packet) it passes data in frame to network layer protocolotherwise adapter discards frame
Type indicates higher layer protocol (mostly IP but others possible eg Novell IPX AppleTalk)CRC checked at receiver if error is detected frame is dropped
5 DataLink Layer 5-47
frame is dropped
Ethernet Unreliable connectionless
connectionless No handshaking between sending and receiving NICs receiving NICs unreliable receiving NIC doesnrsquot send acks or nacksto sending NIC
stream of datagrams passed to network layer can have gaps (missing datagrams)gaps will be filled if app is using TCPotherwise app will see gaps
5 DataLink Layer 5-48
pp g pEthernetrsquos MAC protocol unslotted CSMACD
25
Ethernet CSMACD algorithm1 NIC receives datagram
from network layer creates frame
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
4 If NIC detects another transmission while transmitting aborts and 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
transmitting aborts and sends jam signal
5 After aborting NIC enters exponential backoff after mth collision NIC chooses K at random from
5 DataLink Layer 5-49
3 If NIC transmits entire frame without detecting another transmission NIC is done with frame
random from 012hellip2m-1 NIC waits K512 bit times returns to Step 2
Ethernetrsquos CSMACD (more)Jam Signal make sure all
other transmitters are aware of collision 48 bits
Exponential BackoffGoal adapt retransmission attempts to estimated f
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
attempts to estimated current load
heavy load random wait will be longer
first collision choose K from 01 delay is K 512 bit transmission timesafter second collision choose
5 DataLink Layer 5-50
after second collision choose K from 0123hellipafter ten collisions choose K from 01234hellip1023
Seeinteract with Javaapplet on AWL Web sitehighly recommended
26
CSMACD efficiency
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
Tprop = max prop delay between 2 nodes in LANt = time to transmit max-size framettrans = time to transmit max-size frame
efficiency goes to 1 t t 0
transprop ttefficiency
511
+=
5 DataLink Layer 5-51
as tprop goes to 0as ttrans goes to infinity
better performance than ALOHA and simple cheap decentralized
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standardscommon MAC protocol and frame formatdiff t s ds 2 Mb s 10 Mb s 100 Mb s different speeds 2 Mbps 10 Mbps 100 Mbps 1Gbps 10G bpsdifferent physical layer media fiber cable
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
bits coming in one link go out all other links at same rateall nodes connected to hub can collide with one anotherno frame bufferingno CSMACD at hub host NICs detect collisions
d
5 DataLink Layer 5-55
twisted pair
hub
Switchlink-layer device smarter than hubs take active role
t f d Eth t fstore forward Ethernet framesexamine 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
transparent
5 DataLink Layer 5-56
phosts are unaware of presence of switches
plug-and-play self-learningswitches do not need to be configured
29
Switch allows multiple simultaneous transmissions
hosts have dedicated direct connection to switch
A
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
BCrsquodirect connection to switchswitches buffer packetsEthernet protocol used on each incoming link but no collisions full duplex
each link is its own collision domain Brsquo
C
1 2 345
6
5 DataLink Layer 5-57
switching A-to-Arsquo and B-to-Brsquo simultaneously without collisions
not possible with dumb hub
ArsquoB
switch with six interfaces(123456)
Switch Table
Q how does switch know that Arsquo reachable via interface 4
A
BCrsquoBrsquo reachable via interface 5A each switch has a switch table each entry
(MAC address of host interface to reach host time stamp)
looks like a routing table Brsquo
C
1 2 345
6
5 DataLink Layer 5-58
gQ how are entries created maintained in switch table
something like a routing protocol
ArsquoB
switch with six interfaces(123456)
30
Switch self-learning
switch learns which hosts can be reached through
A
BCrsquo
A Arsquo
Source ADest Arsquo
gwhich interfaces
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived
when frame received switch ldquolearnsrdquo location of sender incoming LAN segmentrecords senderlocation pair in switch table Brsquo
C
1 2 345
6
5 DataLink Layer 5-59
pair in switch tableArsquoB
MAC addr interface TTLSwitch table
(initially empty)A 1 60
Switch frame filteringforwardingWhen frame received
1 record link associated with sending host1 record link associated with sending host2 index switch table using MAC dest address3 if entry found for destination
then if dest on segment from which frame arrived
then drop the framel f d th f i t f i di t d
5 DataLink Layer 5-60
else forward the frame on interface indicated
else flood forward on all but the interface on which the frame arrived