View
220
Download
3
Category
Tags:
Preview:
Citation preview
Chapter 5 slide 1
CS 372 ndash introduction to computer networks
Announcements Assign 5 and Lab 5 will be posted today and
due next Thursday
Acknowledgement slides drawn heavily from Kurose amp Ross
Based in part on slides by Bechir Hamdaoui and Paul D Paulson
Chapter 5 slide 2
Chapter 5 Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of link layer technologies Ethernet
Chapter 5 slide 3
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 4
Link Layer (also known as layer 2)Some terminology nodes = hosts or routers
links = communication channels that connect adjacent nodes
bull wired linksbull wireless links
frame = layer-2 packet
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Chapter 5 slide 5
Link layer context
links may have different link protocolsframes may be delivered by different link protocols over different links eg Ethernet on 1st link frame
relay on intermediate links 80211 on last link
link protocols may provide different services eg may or may not
provide rdt over link
transportation analogy Trip Princeton to Berlin
limo Princeton to JFK plane JFK to Munich train Munich to Berlin
tourist = frame travel agent = routing
algorithm Doesnrsquot knowcare of
mode
transportation mode = link layer protocol
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
reliable delivery between adjacent nodes similar to what is done at transport layer rarely used on low bit-error link (fiber some twisted
pair) often used on wireless links high error rates
Chapter 5 slide 6
Link Layer Services (more) flow control
pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Chapter 5 slide 7
Where is the link layer implemented
in all hosts implemented in network
adapter (NIC network interface card) Ethernet card PCMCI card
80211 card implements link to physical
layer
attaches into hostrsquos system buses
combination of hardware and software
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
Chapter 5 slide 8
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 2
Chapter 5 Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing
instantiation and implementation of link layer technologies Ethernet
Chapter 5 slide 3
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 4
Link Layer (also known as layer 2)Some terminology nodes = hosts or routers
links = communication channels that connect adjacent nodes
bull wired linksbull wireless links
frame = layer-2 packet
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Chapter 5 slide 5
Link layer context
links may have different link protocolsframes may be delivered by different link protocols over different links eg Ethernet on 1st link frame
relay on intermediate links 80211 on last link
link protocols may provide different services eg may or may not
provide rdt over link
transportation analogy Trip Princeton to Berlin
limo Princeton to JFK plane JFK to Munich train Munich to Berlin
tourist = frame travel agent = routing
algorithm Doesnrsquot knowcare of
mode
transportation mode = link layer protocol
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
reliable delivery between adjacent nodes similar to what is done at transport layer rarely used on low bit-error link (fiber some twisted
pair) often used on wireless links high error rates
Chapter 5 slide 6
Link Layer Services (more) flow control
pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Chapter 5 slide 7
Where is the link layer implemented
in all hosts implemented in network
adapter (NIC network interface card) Ethernet card PCMCI card
80211 card implements link to physical
layer
attaches into hostrsquos system buses
combination of hardware and software
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
Chapter 5 slide 8
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 3
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 4
Link Layer (also known as layer 2)Some terminology nodes = hosts or routers
links = communication channels that connect adjacent nodes
bull wired linksbull wireless links
frame = layer-2 packet
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Chapter 5 slide 5
Link layer context
links may have different link protocolsframes may be delivered by different link protocols over different links eg Ethernet on 1st link frame
relay on intermediate links 80211 on last link
link protocols may provide different services eg may or may not
provide rdt over link
transportation analogy Trip Princeton to Berlin
limo Princeton to JFK plane JFK to Munich train Munich to Berlin
tourist = frame travel agent = routing
algorithm Doesnrsquot knowcare of
mode
transportation mode = link layer protocol
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
reliable delivery between adjacent nodes similar to what is done at transport layer rarely used on low bit-error link (fiber some twisted
pair) often used on wireless links high error rates
Chapter 5 slide 6
Link Layer Services (more) flow control
pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Chapter 5 slide 7
Where is the link layer implemented
in all hosts implemented in network
adapter (NIC network interface card) Ethernet card PCMCI card
80211 card implements link to physical
layer
attaches into hostrsquos system buses
combination of hardware and software
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
Chapter 5 slide 8
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 4
Link Layer (also known as layer 2)Some terminology nodes = hosts or routers
links = communication channels that connect adjacent nodes
bull wired linksbull wireless links
frame = layer-2 packet
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Chapter 5 slide 5
Link layer context
links may have different link protocolsframes may be delivered by different link protocols over different links eg Ethernet on 1st link frame
relay on intermediate links 80211 on last link
link protocols may provide different services eg may or may not
provide rdt over link
transportation analogy Trip Princeton to Berlin
limo Princeton to JFK plane JFK to Munich train Munich to Berlin
tourist = frame travel agent = routing
algorithm Doesnrsquot knowcare of
mode
transportation mode = link layer protocol
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
reliable delivery between adjacent nodes similar to what is done at transport layer rarely used on low bit-error link (fiber some twisted
pair) often used on wireless links high error rates
Chapter 5 slide 6
Link Layer Services (more) flow control
pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Chapter 5 slide 7
Where is the link layer implemented
in all hosts implemented in network
adapter (NIC network interface card) Ethernet card PCMCI card
80211 card implements link to physical
layer
attaches into hostrsquos system buses
combination of hardware and software
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
Chapter 5 slide 8
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 5
Link layer context
links may have different link protocolsframes may be delivered by different link protocols over different links eg Ethernet on 1st link frame
relay on intermediate links 80211 on last link
link protocols may provide different services eg may or may not
provide rdt over link
transportation analogy Trip Princeton to Berlin
limo Princeton to JFK plane JFK to Munich train Munich to Berlin
tourist = frame travel agent = routing
algorithm Doesnrsquot knowcare of
mode
transportation mode = link layer protocol
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
reliable delivery between adjacent nodes similar to what is done at transport layer rarely used on low bit-error link (fiber some twisted
pair) often used on wireless links high error rates
Chapter 5 slide 6
Link Layer Services (more) flow control
pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Chapter 5 slide 7
Where is the link layer implemented
in all hosts implemented in network
adapter (NIC network interface card) Ethernet card PCMCI card
80211 card implements link to physical
layer
attaches into hostrsquos system buses
combination of hardware and software
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
Chapter 5 slide 8
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Link Layer Services framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
reliable delivery between adjacent nodes similar to what is done at transport layer rarely used on low bit-error link (fiber some twisted
pair) often used on wireless links high error rates
Chapter 5 slide 6
Link Layer Services (more) flow control
pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Chapter 5 slide 7
Where is the link layer implemented
in all hosts implemented in network
adapter (NIC network interface card) Ethernet card PCMCI card
80211 card implements link to physical
layer
attaches into hostrsquos system buses
combination of hardware and software
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
Chapter 5 slide 8
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Link Layer Services (more) flow control
pacing between adjacent sending and receiving nodes
error detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
error correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Chapter 5 slide 7
Where is the link layer implemented
in all hosts implemented in network
adapter (NIC network interface card) Ethernet card PCMCI card
80211 card implements link to physical
layer
attaches into hostrsquos system buses
combination of hardware and software
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
Chapter 5 slide 8
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Where is the link layer implemented
in all hosts implemented in network
adapter (NIC network interface card) Ethernet card PCMCI card
80211 card implements link to physical
layer
attaches into hostrsquos system buses
combination of hardware and software
controller
physicaltransmission
cpu memory
host bus (eg PCI)
network adaptercard
host schematic
applicationtransportnetwork
link
linkphysical
Chapter 5 slide 8
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
NICs Communicating
sending side encapsulates datagram in
hardware frame adds address info error
checking bits reliable data transfer flow control etc
sends to all hosts that are directly connected
receiving side checks address looks for errors reliable
data transfer flow control etc
extracts datagram from hardware frame and passes it up to next layer
controller controller
sending host receiving host
datagram datagram
datagram
frame
Chapter 5 slide 9
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 10
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 11
Error DetectionD = Data protected by error checking may include header fields EDC= Error Detection and Correction bits (redundancy)
bull error detection not 100 reliable may not detect errors (rarely)bull larger EDC field yields better detection and correctionbull Parity check Checksum Cyclic redundancy check (CRC)
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 12
Example Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
In this exampleD = data bits EDC = parity bit
1
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 13
Checksumming Cyclic Redundancy Check
Scheme View data bits D as a binary
number
Fix r CRC bits
Choose r+1 bit pattern (generator) G
Sender choose r CRC bits R such that G exactly divides ltDRgt (modulo 2)
receiver knows G divides ltDRgt by G If non-zero remainder error detected
widely used in practice (Ethernet 80211 WiFi ATM)
Example D= 101110
r = 3 bits
G = 1001
Find R such thatG divides ltDRgt
(modulo 2)equivalently
G divides ltD2r XOR Rgt
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 14
CRC modulo-2 arithmetic CRC calculations are done modulo-2 arithmetic
No carries in addition No borrows in subtraction=gt Addition = subtraction = bitwise-XOR XOR review
0 XOR 0 = 0 0 XOR 1 = 1 1 XOR 0 = 1 1 XOR 1 = 0=gt a XOR 0 = a amp a XOR a = 0 for a=01Eg 1010 XOR 0110 = 1110
Multiplications and divisions are same as in base-2 arithmetic except all additions and subtractions are done without carries or borrowsbull That is addition = subtraction = bitwise-XOR
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 15
CRC Example
R = remainder[ ]D2r
G
Want G divides ltD2r XOR Rgt
equivalently D2r XOR R = nG
equivalently (XOR both sides)
(D2r XOR R) XOR R = nG XOR R
equivalently (R XOR R = 0 amp a XOR 0 = a)
D2r = nG XOR R
equivalently (division is modulo 2 too)
since remainder[(nG XOR R)G] = R
(note R lt G) then dividing D2r by G (modulo 2) gives remainder = R
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 16
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Link-layer Addressing5 Ethernet
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 17
Multiple Access Links and Protocols
Two types of ldquolinksrdquo point-to-point
PPP for dial-up access point-to-point link between Ethernet switch and host
broadcast (shared wire or medium) Ethernet 80211 wireless LAN
shared wire (eg cabled Ethernet)
shared RF (eg 80211 WiFi)
shared RF(satellite)
humans at acocktail party
(shared air acoustical)
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 18
Multiple Access protocolsneed for sharing of mediumchannel single channel
needs be used by all nodes
interferencecollisiontwo or more simultaneous transmissions lead to collided signals
multiple access protocol allows multiple concurrent access
algorithm that nodes use to share channel ie determines when a node can transmit
no coordination no out-of-band channelagreeing about channel sharing must use channel itself
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 19
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions need to know how to ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo nodes take turns but nodes with more to send can
take longer turns
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 20
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt
trans time) in each round unused slots go idle
Eg 6-station LAN 134 have pkt slots 256 idle
1 3 4 1 3 4
6-slotframe
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 21
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go
idle Eg 6-station LAN 134 have pkt frequency bands
256 idle fr
equ
ency
bands time
FDM cable
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 22
Random Access Protocols distributed
unlike TDMA or FDMA no coordination among nodes
one node at a time when a node transmits it does so at full data rate R
collisions can occur two or more transmitting nodes ldquocollisionrdquo
random access MAC protocol specifies how to detect collisions how to recover from collisions
examples of random access MAC protocols ALOHA CSMACD CSMACA (CSMA Carrier Sense Multiple Access
CD Collision Detection CA Collision Avoidance)
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 23
Slotted ALOHA
Assumptions all frames same size
time divided into slots slot = time to transmit 1
frame
start transmit at beginning of slot only
nodes are synchronized
if multiple nodes transmit in slot all can detect collision
Operation when node gets a fresh frame
transmits in next slot
if no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 24
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots wasting
slots clock synchronization
LegendC =
collisionE =
emptyidle
S = success
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 25
Slotted Aloha efficiency
suppose N nodes with many frames to send each transmits in slot with probability p
prob that given node has success in a slot p(1-p)N-1
prob that exactly one node of N nodes has a success Np(1-p)N-1
Efficiency = Np(1-p)N-1
Efficiency long-run fraction of successful slots (many nodes all with many frames to send)
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 26
Slotted Aloha efficiency Efficiency = Np(1-p)N-1
max efficiency find p that maximizes Np(1-p)N-1
p = 1N
Max Eff = (1-1N)N-1
When N increases to max eff = (1-1N)N-1 goes
to 1e = 37
At best channel used for 37 useful transmission time
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 29
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
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Chapter 5 slide 30
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 31
CSMACD (Collision Detection)CD (collision detection)
easy in wired LANs measure signal strengths compare transmitted received signals
difficult in wireless LANs received signal strength overwhelmed by local transmission strength
human analogy the polite conversationalist
CSMACD (CSMA w Collision Detection) collisions detectable colliding transmissions aborted reducing channel wastage
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 32
CSMACD collision detection
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 33
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
master
slaves
poll
data
data
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 34
ldquoTaking Turnsrdquo MAC protocolsToken passing control token
passed from one node to next sequentially
If token then send message
concerns token overhead latency single point of failure
(token)
T
data
(nothingto send)
T
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Summary of MA protocols channel partitioning by time or frequency
Time Division Frequency Division random access (dynamic)
Donrsquot start talking again right away Waiting for a random time before trying again carrier sensing easy in some technologies
(wire) hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
taking turns polling from central site token passing
bull Bluetooth FDDI IBM Token Ring
Chapter 5 slide 35
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 36
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
A little more about Physical Layer
LAN topologies Networks may be classified by shape Three most popular
Star Ring Bus
Networks may be classified by ldquoshared medium Cable Wireless Others hellip
Chapter 5 slide 37
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Star topology
All computers attach to a central point Center of star is usually a server or a
switched hub
Chapter 5 slide 38
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Star topology
Dont be confused by a diagram ldquoTopologyrdquo refers to logical connections
(not physical layout) A likely diagram of a star topology LAN
Chapter 5 slide 39
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Star topology
If implemented with a hub the hub must be programmable (switched) Switch ldquolearnsrdquo connections Can services multiple transmissions simultaneously
Chapter 5 slide 40
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Ring topology Computers connected in a closed loop First passes data to second second passes
data to third etc
Chapter 5 slide 41
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Ring topology
Refers to logical connections (not physical layout)
In practice there is a short connector cable from the computer to the ring
Chapter 5 slide 42
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Ring topology
Can be implemented inside a ldquobox Dont confuse with Star topology
Chapter 5 slide 43
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Bus topology Single cable connects all computers Each computer has connector to shared cable Computers must synchronize and allow only one
computer to transmit at a time
Terminator Terminator
Chapter 5 slide 44
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Bus topology
Can be implemented inside a ldquoboxldquo (unswitched hub)
Dont confuse with Star topology
Chapter 5 slide 45
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Hubshellip physical-layer (ldquodumbrdquo) repeaters
bits coming in one link go out all other links at same rate
all nodes connected to hub can collide with one another no frame buffering no CSMACD at hub host NICs detect collisions
twisted pair
hub
Chapter 5 slide 46
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Switch link-layer device smarter than hubs take active
role store forward Ethernet frames examine incoming framersquos MAC address selectively
forward frame to one-or-more outgoing links when frame is to be forwarded on segment uses CSMACD to access segment
transparent hosts are unaware of presence of switches
plug-and-play self-learning switches do not need to be configured
Chapter 5 slide 47
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Switch Table
Q how does switch know that Arsquo reachable via interface 4 Brsquo reachable via interface 5
A each switch has a switch table each entry (MAC address of host interface
to reach host time stamp)
looks like a routing table Q how are entries created
maintained in switch table something like a routing
protocol
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 2 345
6
Chapter 5 slide 48
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Switch self-learning
switch learns which hosts can be reached through which interfaces when frame received
switch ldquolearnsrdquo location of sender incoming LAN segment
records senderlocation pair in switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
Chapter 5 slide 49
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Self-learning forwarding example
A
Arsquo
B
Brsquo
C
Crsquo
1 2 345
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
A ArsquoA ArsquoA ArsquoA ArsquoA Arsquo
frame destination unknownflood
Arsquo A
destination A location known
Arsquo 4 60
selective send
Chapter 5 slide 50
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Interconnecting switches
switches can be connected together
A
B
Q sending from A to G - how does S1 know to forward frame destined to F via S4 and S3
A self learning (works exactly the same as in single-switch case)
S1
C DE
FS2
S4
S3
HI
G
Chapter 5 slide 51
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Institutional network
to externalnetwork router
IP subnet
mail server
web server
Chapter 5 slide 52
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Switches vs Routers both store-and-forward devices
routers network layer devices (examine network layer headers) switches are link layer devices
routers maintain routing tables implement routing algorithms
switches maintain switch tables implement filtering learning algorithms
SwitchChapter 5 slide 53
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 54
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 55
MAC Addresses 32-bit IP address
network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address 48 bit MAC address (for most LANs)
bull burned in NIC ROM also sometimes software settable function get frame from one interface to another physically-
connected interface (same network) uses hexadecimal representation ie base-16 (ie 4 bits) it uses 16 distinct symbols 01hellip9ABCDEF 4 bits needed for each symbol 484 = 12 symbols
Eg 1A-2F-BB-76-09-AD
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 56
MAC AddressesEach adapter on LAN has unique MAC (LAN ) address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 57
A encapsulates BrsquoMAC into the frame
A sends the frame into the medium
All nodes will hear the frame
Only B grabs the frame
All other nodes discard the frame
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Assume bull A knows Brsquos MAC addressbull A wants to send a frame to B
Node A
Node B
MAC Addresses
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 58
ARP Address Resolution Protocol
Solution ARP Each IP node (host router)
on LAN has ARP table ARP table maps IP MAC
address for some LAN nodes
lt IP address MAC address TTLgt TTL (Time To Live) remove
mapping after TTL (typically 20 min)
A consults its table to determine Brsquos MAC given it knows Brsquos IP
Q how to construct these ARP tables
Question if A doesnrsquot know Brsquos MAC address how does it determine this MAC address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
137196723
137196778
137196714
137196788
Node A
Node B
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 59
ARP Case 1mdashSame LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP packet containing Bs IP address dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query
B receives ARP packet replies to A with its (Bs) MAC address
A sends frame to B since it knows its MAC now
A caches IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information that
times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 60
ARP Case 2mdashrouting to another LAN
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
how does ARP work now Would the previous scenario work
datagram needs to go from A to B via R assume A knows Brsquos IP address
A
B
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
What happens when A wants to send IP datagram to B A knows that B belongs to a different subnet by checking Brsquos IP
address A also knows IP address of router R (routing table at network layer) If necessary A uses ARP to get Rrsquos MAC address for 111111111110 (IP
address of router) A creates frame with Rs MAC address as dest frame contains A-to-B
IP datagram Arsquos NIC sends frame and Rrsquos NIC receives it R removes IP datagram from Ethernet frame sees its destined to B R uses ARP to get Brsquos MAC address (R has Brsquos IP address included in
the just received frame) R creates frame containing A-to-B IP datagram and sends it to B
R
1A-23-F9-CD-06-9B
222222222220111111111110
E6-E9-00-17-BB-4B
CC-49-DE-D0-AB-7D
111111111112
111111111111
74-29-9C-E8-FF-55
222222222221
88-B2-2F-54-1A-0F
222222222222
49-BD-D2-C7-56-2A
ARP Case 2mdashrouting to another LAN
A
B
Chapter 5 slide 61
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 63
Link Layer
1 Introduction and services2 Error detection and correction 3 Multiple access protocols4 Topologies and switches 5 Link-layer Addressing6 Ethernet
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 64
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for NIC (Network Interface Card) first widely used LAN technology simpler cheaper than token LANs and ATM kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 65
Ethernet topology bus topology popular through mid 90s
all nodes in same collision domain (can collide with each other)
today star topology prevails active switch in center each ldquospokerdquo runs a (separate) Ethernet protocol (nodes do
not collide with each other)
bus coaxial cable
switch
star
Ethernet cable (called a segment)
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
8023 Ethernet Standards Link amp Physical Layers
many different Ethernet standards common MAC protocol and frame format different speeds 2 Mbps 10 Mbps 100 Mbps
1Gbps 10G bps different physical layer media fiber cable
wireless
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisterpair) physical layer
Chapter 5 slide 66
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 67
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble total 8 bytes 7 bytes each with pattern 10101010
followed by one byte with pattern 10101011
used to synchronize receiver sender clock rates (senderrsquos data rate matches receiverrsquos data rate)
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 68
Addresses 6 bytes if adapter receives frame with matching destination address or
with broadcast address (eg ARP packet) it passes data in frame to network layer protocol
otherwise 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
Ethernet Frame Structure
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 69
Ethernet Unreliable connectionless connectionless No handshaking between sending
and receiving NICs
unreliable receiving NIC doesnrsquot send acks or nacks to sending NIC stream of datagrams passed to network layer can have
gaps (missing datagrams) gaps will be filled if app is using TCP otherwise app will see gaps
Ethernetrsquos MAC protocol CSMACD(more on this nexthellip)
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 70
CSMACD vs slotted ALOHA
CSMACD1 Unsychronized
NIC (adapter) may transmit at anytime no notion of timeslots
2 Carrier-sense Never transmit if others are transmitting
3 Collision detectionstop transmitting as soon as collision is detected
4 Random backoffwait a random time before retransmitting (more later)
Slotted ALOHA1 Sychronized
transmit at beginning of a timeslot only
2 No carrier-sense No check for whether others transmit or not
3 No collision detectionno stop during collision
4 No random backoff
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 71
Notion of bit time
Example consider a 10 Mbps Ethernet linkQ1 what is a ldquobit timerdquoA1 1(10x10^6) second = 01 microsecond
Q2 how much time is ldquo96 bit timerdquoA2 96 x 01 = 96 microsecond
Before describing CSMACD letrsquos introduce
bit time = time to transmit one bit on a Ethernet link
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 72
Ethernet CSMACD algorithm
1 adapter receives datagram from network layer creates frame
2 If adapter senses channel idle for 96 bit time starts frame transmission(gap to allow interface recovery)
3 If adapter senses channel busy waits until channel idle (plus 96 bit time) then transmits
4 If adapter transmits entire frame without detecting another transmission adapter is done with frame
5 If adapter detects another transmission while transmitting aborts and sends a 48-bit jam signal(to make sure all nodes are aware of collision)
6 After aborting (after sending jam signal) adapter enters exponential backoff adapter chooses K at random(next slide is explained how) adapter waits K512 bit times returns to Step 2
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Exponential Backoff Goal adapt retrans attempts to estimated current load
heavy load random wait will be longer Light load random wait will be shorter
first collision choose K from 01 after 2nd collision choose K from 0123 after 3rd collision choose K from 01234567 after 10th collision choose K from 01234hellip1023
after 10 collision choose K from 012hellip1023 Then delay transmission until K 512 bit times
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Chapter 5 slide 74
Example A and B are connected via an Ethernet link of 10 Mbps Propagation delay between them = 224 bit time At time t=0 both transmit which results in collision After collision A chooses K=0 and B chooses K=1
A B10Mbps
Q1 how much is ldquobit timerdquo =110 = 01 microsecond
Q2 at what time does collision occur=(2242) x 01 = 112 microsecond
Q3 at what time does bus become idle=224 (both A amp B detect collision) + 48 (A amp B finish sending jam signals) + 224 (last bit of Brsquos jam signal arrives at A) = 496 bit time
=496x01 (bit time)= 496 micseccond
Q4 at what time does A begin retransmission[496 (bus becomes idle) + 96]x01 (bit time)= 592 micsecond
Recommended