Upload
nguyenhuong
View
219
Download
0
Embed Size (px)
Citation preview
1
Redes de Computadores
LEIC-A MEIC-A
5 ndash Data Link Layer
Prof Paulo Lobato CorreiaIST DEEC ndash Aacuterea Cientiacutefica de Telecomunicaccedilotildees
RC ndash Prof Paulo Lobato Correia 2
Objectives
Understand principles behind data link layer services
Link layer addressing
Error detection and correction
Sharing a broadcast channel multiple access
Reliable data transfer flow control (done)
Instantiation and implementation of
various link layer technologies
2
RC ndash Prof Paulo Lobato Correia 3
Outline
Introduction and services
Link-layer addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 4
Link Layer Introduction
Some terminology
Hosts and routers are nodes
Communication channels that
connect adjacent nodes along
communication path are links Wired links
Wireless links
LANs
Layer-2 packet is a frameIt encapsulates a datagram
Data link layer has the responsibility of transferring datagrams
from one node to the adjacent node over a link
3
RC ndash Prof Paulo Lobato Correia 5
Link Layer Context
Datagram transferred by different link protocols over different links Eg Ethernet on first link frame relay on intermediate links 80211 on
last link
Each link protocol provides different services Eg may or may not provide reliable data transfer over link
Transportation analogy Trip from Oeiras to Rennes
bus Oeiras to Lisboa
plane Lisboa to Paris
train Paris to Rennes
Tourist = datagram
Transport segment = communication link
Transportation mode = link layer protocol
Travel agent = routing algorithm
RC ndash Prof Paulo Lobato Correia 6
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 destination
bull Different from IP address
Reliable delivery between adjacent nodes
Similar solutions to those adopted in transport layer
Seldom used on low bit-error links (fiber some twisted pair)
Wireless links high error rates
Q Why both link-level and end-end reliability
4
RC ndash Prof Paulo Lobato Correia 7
Link Layer Services
Flow control
Pacing between adjacent sending and receiving nodes
Error detection
Errors caused by signal attenuation and 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
Half-duplex and full-duplex
With half duplex nodes at both ends of link can transmit but not at same time
RC ndash Prof Paulo Lobato Correia 8
Link Layer
The link layer deals with data transfer between a host and a router or between two routers belonging to the same network
Data link layer tasks
5
RC ndash Prof Paulo Lobato Correia 9
Hop-to-hop Delivery
RC ndash Prof Paulo Lobato Correia 10
Where is the Link Layer Implemented
In each and every host
Link layer implemented in the ldquoadaptorrdquo (aka network interface
card - NIC)
Ethernet card PCMCI card 80211 card
Implements link physical layer
Attaches into hostrsquos system buses
Combination of hardware software firmware
controller
physicaltransmission
cpu memory
host
bus
(eg PCI)
network adapter
card
host schematic
applicationtransportnetwork
link
linkphysical
6
RC ndash Prof Paulo Lobato Correia 11
Adaptors Communicating
Sending side
Encapsulates datagram in frame
Adds error checking bits flow control etc
Receiving side
Looks for errors flow control etc
Extracts datagram and passes it to the upper layer at the receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
RC ndash Prof Paulo Lobato Correia 12
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
IEEE 80211 Wireless LANs
Link-layer switches
Framing
7
RC ndash Prof Paulo Lobato Correia 13
Link-Layer Addressing
IP address ndash Network Layer
Used to get datagram to the destination IP subnet
32-bit IP address
Hierarchical
Not portable
MAC (or LAN or physical) address ndash Data Link Layer
Function get frame from one interface to another physically-
connected interface (in the same network)
48 bit MAC address (for most LANs)
bull Burned in NIC ROM Sometimes adjustable by software
Portable
RC ndash Prof Paulo Lobato Correia 17
MAC Addresses
Each adapter on a LAN has a unique MAC 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)
8
RC ndash Prof Paulo Lobato Correia 19
To deliver frames the physical (MAC) address of the host needs to be known
ARP allows to get the MAC address from the IP address
Address Resolution Protocol (ARP)
RC ndash Prof Paulo Lobato Correia 25
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
2
RC ndash Prof Paulo Lobato Correia 3
Outline
Introduction and services
Link-layer addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 4
Link Layer Introduction
Some terminology
Hosts and routers are nodes
Communication channels that
connect adjacent nodes along
communication path are links Wired links
Wireless links
LANs
Layer-2 packet is a frameIt encapsulates a datagram
Data link layer has the responsibility of transferring datagrams
from one node to the adjacent node over a link
3
RC ndash Prof Paulo Lobato Correia 5
Link Layer Context
Datagram transferred by different link protocols over different links Eg Ethernet on first link frame relay on intermediate links 80211 on
last link
Each link protocol provides different services Eg may or may not provide reliable data transfer over link
Transportation analogy Trip from Oeiras to Rennes
bus Oeiras to Lisboa
plane Lisboa to Paris
train Paris to Rennes
Tourist = datagram
Transport segment = communication link
Transportation mode = link layer protocol
Travel agent = routing algorithm
RC ndash Prof Paulo Lobato Correia 6
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 destination
bull Different from IP address
Reliable delivery between adjacent nodes
Similar solutions to those adopted in transport layer
Seldom used on low bit-error links (fiber some twisted pair)
Wireless links high error rates
Q Why both link-level and end-end reliability
4
RC ndash Prof Paulo Lobato Correia 7
Link Layer Services
Flow control
Pacing between adjacent sending and receiving nodes
Error detection
Errors caused by signal attenuation and 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
Half-duplex and full-duplex
With half duplex nodes at both ends of link can transmit but not at same time
RC ndash Prof Paulo Lobato Correia 8
Link Layer
The link layer deals with data transfer between a host and a router or between two routers belonging to the same network
Data link layer tasks
5
RC ndash Prof Paulo Lobato Correia 9
Hop-to-hop Delivery
RC ndash Prof Paulo Lobato Correia 10
Where is the Link Layer Implemented
In each and every host
Link layer implemented in the ldquoadaptorrdquo (aka network interface
card - NIC)
Ethernet card PCMCI card 80211 card
Implements link physical layer
Attaches into hostrsquos system buses
Combination of hardware software firmware
controller
physicaltransmission
cpu memory
host
bus
(eg PCI)
network adapter
card
host schematic
applicationtransportnetwork
link
linkphysical
6
RC ndash Prof Paulo Lobato Correia 11
Adaptors Communicating
Sending side
Encapsulates datagram in frame
Adds error checking bits flow control etc
Receiving side
Looks for errors flow control etc
Extracts datagram and passes it to the upper layer at the receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
RC ndash Prof Paulo Lobato Correia 12
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
IEEE 80211 Wireless LANs
Link-layer switches
Framing
7
RC ndash Prof Paulo Lobato Correia 13
Link-Layer Addressing
IP address ndash Network Layer
Used to get datagram to the destination IP subnet
32-bit IP address
Hierarchical
Not portable
MAC (or LAN or physical) address ndash Data Link Layer
Function get frame from one interface to another physically-
connected interface (in the same network)
48 bit MAC address (for most LANs)
bull Burned in NIC ROM Sometimes adjustable by software
Portable
RC ndash Prof Paulo Lobato Correia 17
MAC Addresses
Each adapter on a LAN has a unique MAC 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)
8
RC ndash Prof Paulo Lobato Correia 19
To deliver frames the physical (MAC) address of the host needs to be known
ARP allows to get the MAC address from the IP address
Address Resolution Protocol (ARP)
RC ndash Prof Paulo Lobato Correia 25
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
3
RC ndash Prof Paulo Lobato Correia 5
Link Layer Context
Datagram transferred by different link protocols over different links Eg Ethernet on first link frame relay on intermediate links 80211 on
last link
Each link protocol provides different services Eg may or may not provide reliable data transfer over link
Transportation analogy Trip from Oeiras to Rennes
bus Oeiras to Lisboa
plane Lisboa to Paris
train Paris to Rennes
Tourist = datagram
Transport segment = communication link
Transportation mode = link layer protocol
Travel agent = routing algorithm
RC ndash Prof Paulo Lobato Correia 6
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 destination
bull Different from IP address
Reliable delivery between adjacent nodes
Similar solutions to those adopted in transport layer
Seldom used on low bit-error links (fiber some twisted pair)
Wireless links high error rates
Q Why both link-level and end-end reliability
4
RC ndash Prof Paulo Lobato Correia 7
Link Layer Services
Flow control
Pacing between adjacent sending and receiving nodes
Error detection
Errors caused by signal attenuation and 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
Half-duplex and full-duplex
With half duplex nodes at both ends of link can transmit but not at same time
RC ndash Prof Paulo Lobato Correia 8
Link Layer
The link layer deals with data transfer between a host and a router or between two routers belonging to the same network
Data link layer tasks
5
RC ndash Prof Paulo Lobato Correia 9
Hop-to-hop Delivery
RC ndash Prof Paulo Lobato Correia 10
Where is the Link Layer Implemented
In each and every host
Link layer implemented in the ldquoadaptorrdquo (aka network interface
card - NIC)
Ethernet card PCMCI card 80211 card
Implements link physical layer
Attaches into hostrsquos system buses
Combination of hardware software firmware
controller
physicaltransmission
cpu memory
host
bus
(eg PCI)
network adapter
card
host schematic
applicationtransportnetwork
link
linkphysical
6
RC ndash Prof Paulo Lobato Correia 11
Adaptors Communicating
Sending side
Encapsulates datagram in frame
Adds error checking bits flow control etc
Receiving side
Looks for errors flow control etc
Extracts datagram and passes it to the upper layer at the receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
RC ndash Prof Paulo Lobato Correia 12
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
IEEE 80211 Wireless LANs
Link-layer switches
Framing
7
RC ndash Prof Paulo Lobato Correia 13
Link-Layer Addressing
IP address ndash Network Layer
Used to get datagram to the destination IP subnet
32-bit IP address
Hierarchical
Not portable
MAC (or LAN or physical) address ndash Data Link Layer
Function get frame from one interface to another physically-
connected interface (in the same network)
48 bit MAC address (for most LANs)
bull Burned in NIC ROM Sometimes adjustable by software
Portable
RC ndash Prof Paulo Lobato Correia 17
MAC Addresses
Each adapter on a LAN has a unique MAC 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)
8
RC ndash Prof Paulo Lobato Correia 19
To deliver frames the physical (MAC) address of the host needs to be known
ARP allows to get the MAC address from the IP address
Address Resolution Protocol (ARP)
RC ndash Prof Paulo Lobato Correia 25
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
4
RC ndash Prof Paulo Lobato Correia 7
Link Layer Services
Flow control
Pacing between adjacent sending and receiving nodes
Error detection
Errors caused by signal attenuation and 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
Half-duplex and full-duplex
With half duplex nodes at both ends of link can transmit but not at same time
RC ndash Prof Paulo Lobato Correia 8
Link Layer
The link layer deals with data transfer between a host and a router or between two routers belonging to the same network
Data link layer tasks
5
RC ndash Prof Paulo Lobato Correia 9
Hop-to-hop Delivery
RC ndash Prof Paulo Lobato Correia 10
Where is the Link Layer Implemented
In each and every host
Link layer implemented in the ldquoadaptorrdquo (aka network interface
card - NIC)
Ethernet card PCMCI card 80211 card
Implements link physical layer
Attaches into hostrsquos system buses
Combination of hardware software firmware
controller
physicaltransmission
cpu memory
host
bus
(eg PCI)
network adapter
card
host schematic
applicationtransportnetwork
link
linkphysical
6
RC ndash Prof Paulo Lobato Correia 11
Adaptors Communicating
Sending side
Encapsulates datagram in frame
Adds error checking bits flow control etc
Receiving side
Looks for errors flow control etc
Extracts datagram and passes it to the upper layer at the receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
RC ndash Prof Paulo Lobato Correia 12
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
IEEE 80211 Wireless LANs
Link-layer switches
Framing
7
RC ndash Prof Paulo Lobato Correia 13
Link-Layer Addressing
IP address ndash Network Layer
Used to get datagram to the destination IP subnet
32-bit IP address
Hierarchical
Not portable
MAC (or LAN or physical) address ndash Data Link Layer
Function get frame from one interface to another physically-
connected interface (in the same network)
48 bit MAC address (for most LANs)
bull Burned in NIC ROM Sometimes adjustable by software
Portable
RC ndash Prof Paulo Lobato Correia 17
MAC Addresses
Each adapter on a LAN has a unique MAC 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)
8
RC ndash Prof Paulo Lobato Correia 19
To deliver frames the physical (MAC) address of the host needs to be known
ARP allows to get the MAC address from the IP address
Address Resolution Protocol (ARP)
RC ndash Prof Paulo Lobato Correia 25
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
5
RC ndash Prof Paulo Lobato Correia 9
Hop-to-hop Delivery
RC ndash Prof Paulo Lobato Correia 10
Where is the Link Layer Implemented
In each and every host
Link layer implemented in the ldquoadaptorrdquo (aka network interface
card - NIC)
Ethernet card PCMCI card 80211 card
Implements link physical layer
Attaches into hostrsquos system buses
Combination of hardware software firmware
controller
physicaltransmission
cpu memory
host
bus
(eg PCI)
network adapter
card
host schematic
applicationtransportnetwork
link
linkphysical
6
RC ndash Prof Paulo Lobato Correia 11
Adaptors Communicating
Sending side
Encapsulates datagram in frame
Adds error checking bits flow control etc
Receiving side
Looks for errors flow control etc
Extracts datagram and passes it to the upper layer at the receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
RC ndash Prof Paulo Lobato Correia 12
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
IEEE 80211 Wireless LANs
Link-layer switches
Framing
7
RC ndash Prof Paulo Lobato Correia 13
Link-Layer Addressing
IP address ndash Network Layer
Used to get datagram to the destination IP subnet
32-bit IP address
Hierarchical
Not portable
MAC (or LAN or physical) address ndash Data Link Layer
Function get frame from one interface to another physically-
connected interface (in the same network)
48 bit MAC address (for most LANs)
bull Burned in NIC ROM Sometimes adjustable by software
Portable
RC ndash Prof Paulo Lobato Correia 17
MAC Addresses
Each adapter on a LAN has a unique MAC 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)
8
RC ndash Prof Paulo Lobato Correia 19
To deliver frames the physical (MAC) address of the host needs to be known
ARP allows to get the MAC address from the IP address
Address Resolution Protocol (ARP)
RC ndash Prof Paulo Lobato Correia 25
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
6
RC ndash Prof Paulo Lobato Correia 11
Adaptors Communicating
Sending side
Encapsulates datagram in frame
Adds error checking bits flow control etc
Receiving side
Looks for errors flow control etc
Extracts datagram and passes it to the upper layer at the receiving side
controller controller
sending host receiving host
datagram datagram
datagram
frame
RC ndash Prof Paulo Lobato Correia 12
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
IEEE 80211 Wireless LANs
Link-layer switches
Framing
7
RC ndash Prof Paulo Lobato Correia 13
Link-Layer Addressing
IP address ndash Network Layer
Used to get datagram to the destination IP subnet
32-bit IP address
Hierarchical
Not portable
MAC (or LAN or physical) address ndash Data Link Layer
Function get frame from one interface to another physically-
connected interface (in the same network)
48 bit MAC address (for most LANs)
bull Burned in NIC ROM Sometimes adjustable by software
Portable
RC ndash Prof Paulo Lobato Correia 17
MAC Addresses
Each adapter on a LAN has a unique MAC 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)
8
RC ndash Prof Paulo Lobato Correia 19
To deliver frames the physical (MAC) address of the host needs to be known
ARP allows to get the MAC address from the IP address
Address Resolution Protocol (ARP)
RC ndash Prof Paulo Lobato Correia 25
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
7
RC ndash Prof Paulo Lobato Correia 13
Link-Layer Addressing
IP address ndash Network Layer
Used to get datagram to the destination IP subnet
32-bit IP address
Hierarchical
Not portable
MAC (or LAN or physical) address ndash Data Link Layer
Function get frame from one interface to another physically-
connected interface (in the same network)
48 bit MAC address (for most LANs)
bull Burned in NIC ROM Sometimes adjustable by software
Portable
RC ndash Prof Paulo Lobato Correia 17
MAC Addresses
Each adapter on a LAN has a unique MAC 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)
8
RC ndash Prof Paulo Lobato Correia 19
To deliver frames the physical (MAC) address of the host needs to be known
ARP allows to get the MAC address from the IP address
Address Resolution Protocol (ARP)
RC ndash Prof Paulo Lobato Correia 25
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
8
RC ndash Prof Paulo Lobato Correia 19
To deliver frames the physical (MAC) address of the host needs to be known
ARP allows to get the MAC address from the IP address
Address Resolution Protocol (ARP)
RC ndash Prof Paulo Lobato Correia 25
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
9
RC ndash Prof Paulo Lobato Correia 26
Origin Cause PreventionLine break Storms accidents
White noise Electron motion Raise signal level
Impulsive noise Lightening voltage changes car ignition
Isolate or move wires
Cross-talk Guard bands too smallWires too close
Increase guard band or isolate wires
Eco Bad quality connections Fix or adjust equipment
Lossattenuation Signal intensity decreases with distance
Use repeaters or regenerators
Intermodulation noise
Combination of signals with different origins
Isolate or move wires
Jitter Phase changes in the signals Adjust the equipments
Harmonic distortion
Non-linear amplification in frequency Adjust the equipments
Why are there Transmission Errors
RC ndash Prof Paulo Lobato Correia 27
Error Examples
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
10
RC ndash Prof Paulo Lobato Correia 28
Error Types
Error types
Isolated
Burst
RC ndash Prof Paulo Lobato Correia 29
Error Detection
Error detection
Uses redundancy ndash bits are added to allow error detection in the receptor
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
11
RC ndash Prof Paulo Lobato Correia 30
Error Detection
Methods
Vertical redundancy check (VRC) ndash one parity bit is added to each data unit to ensure that the total number of 1s is even (or odd)
Longitudinal redundancy check (LRC) or Two Dimensional Bit Parity ndash a block of bits is divided into lines and a redundant line is added to the complete block
Cyclic redundancy check (CRC) ndash a set of additional bits computed from the division by a generator polynomial known by the sender and the receiver
RC ndash Prof Paulo Lobato Correia 31
Error Detection VRC
Does not detect an even number of bits in error
A substantial overhead is introduced example 18 = 125
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
12
RC ndash Prof Paulo Lobato Correia 32
Error Detection LRC ndash Two Dimensional Bit Parity
RC ndash Prof Paulo Lobato Correia 33
Detect and correct single bit errors
0 0
Error Detection LRC ndash Two Dimensional Bit Parity
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
13
RC ndash Prof Paulo Lobato Correia 34
Error Detection
EDC ndash Error Detection and Correction bits (redundancy)
D ndash Data protected by error checking may include header fields
Error detection is not 100 reliable
Protocol may miss some errors but rarely
Larger EDC field yields better detection and correction
RC ndash Prof Paulo Lobato Correia 36
Cyclic Redundancy Check (CRC)
Widely used in practice (Ethernet 80211 WiFi ATM)
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
14
RC ndash Prof Paulo Lobato Correia 37
Error Detection CRC
Uses a generator polynomial G(x) of degree n
A message with m bits is viewed as a polynomial M(x) of degree lower than m
CRC computation
Dividend is xnM(x)
Divisor is G(x)
Modulo 2 division (exclusive or) produces a remainder R(x) of degree lower than n
The transmitted message is T(x) = xnM(x) + R(x)
Note that T(x) is divisible by G(x)
Error detection
If the received message is divisible by G(x) then no error are detected
RC ndash Prof Paulo Lobato Correia 46
CRC Example
M(x) = x7 + x4 + x3 + x1
(mensagem)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
x3 M(x) = x10 + x7 + x6 + x4
(dividendo)
R(x) = x2 + 1(resto)
T(x) = x3 M(x) + R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem transmitida ndash incluindo CRC)
1101 (n = 3)
1001 1010 (m=8)
100 1101 0000
101
10011010101
10011010000 11011101 11111001
1001110110001101
10111101
1100110100100000
01000000
10001101101
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
15
RC ndash Prof Paulo Lobato Correia 47
CRC Example (2)
x3M(x)+R(x) = x10 + x7 + x6 + x4 + x2 + 1(mensagem recebida ndash incluindo CRC)
G(x) = x3 + x2 + 1(polinoacutemio gerador)
Rrsquo(x) = 0(natildeo haacute erros ou os erros natildeo satildeo detectados)
1101 (n = 3)
1001 1010 101
000
10011010101 11011101 11111001
1001110110001101
10111101
1100110100110000
01100000
11011101000
RC ndash Prof Paulo Lobato Correia 48
CRC Properties
Let T(x) + E(x) be the received message with E(x) being the error
pattern
The error pattern is detected if and only if E(x) is not divisible by G(x)
Single errors are detected is G(x) has more than one term
Odd number of errors are detected if G(x) has x + 1 as a factor
Burst errors of length smaller or equal to n are detected if G(x) has
degree n and includes the term 1 (ie x0)
Burst errors of length n + 1 are detected with probability 1 2 n ndash 1 if G(x)
has degree n and includes the term 1
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
16
RC ndash Prof Paulo Lobato Correia 49
CRC Hardware Implementation
CRC is easily implemented in hardware by using shift registers
G(x) = x5 + x4 + x2 + 1
XOR
Input data
x5 x4 x3 x2 x 1Message M=1010001101
Input when calculating CRC
1010001101 00000
CRC =01110 (to be calculated)
(Input when calculating CRC
1010001101 01110)
RC ndash Prof Paulo Lobato Correia 50
Forward Error Correction
Forward error correction (FEC) uses codes with enough redundancy to allow
the detection and correction of errors on the receptor without requiring the
message retransmission
Examples
Hamming code detects and corrects isolated bit errors
There are more sophisticated techniques often used such as Reed-Solomon codes
FEC is often used in environments with long propagation delays (example satellite
transmissions)
There are hardware implementations of FEC techniques (example V34 modem)
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
17
RC ndash Prof Paulo Lobato Correia 51
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 52
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)
Old-fashioned Ethernet
Upstream HFC
80211 wireless LAN
Shared wire (eg cabled Ethernet)
Shared RF(eg 80211 WiFi)
Shared RF(satellite)
Humans at acocktail party
(shared air acoustical)
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
18
RC ndash Prof Paulo Lobato Correia 53
Multiple Access Protocols
Single shared broadcast channel
Two or more simultaneous transmissions by nodes ndash interference
Collision if node receives two or more signals at the same time
Multiple access protocol
Distributed algorithm that determines how nodes share channel ie
determine when node can transmit
Communication about channel sharing must use the channel itself
No out-of-band channel for coordination
RC ndash Prof Paulo Lobato Correia 54
Ideal Multiple Access Protocol
Broadcast channel of rate R bps
1 When one node wants to transmit it can send at rate R
2 When M nodes want to transmit each can send at average rate RM
3 Fully decentralized
No special node to coordinate transmissions
No synchronization of clocks slots
4 Simple
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
19
RC ndash Prof Paulo Lobato Correia 55
MAC Protocols a Taxonomy
Three broad classes
Fixed Channel Partitioning
Divide channel into smaller ldquopiecesrdquo (time slots frequencies codes)
Allocate piece to node for exclusive use
Random Access
Channel not divided allow collisions
ldquoRecoverrdquo from collisions
Dynamic Allocation (ldquoTaking turnsrdquo)
Nodes take turns (but nodes with more to send can take longer turns)
PollSelect Token passing
RC ndash Prof Paulo Lobato Correia 56
Fixed Channel Partitioning FDMA
FDMA ndash Frequency Division Multiple Access
Channel spectrum divided into frequency bands
Each station assigned a fixed frequency band
Unused transmission time in frequency bands go idle
frequ
enc
y b
ands
FDM cable
Example of 6-station LAN
134 have packets
Frequency bands 256 are idle
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
20
RC ndash Prof Paulo Lobato Correia 57
FDMA
FDMA ndash Frequency Division Multiple Access
RC ndash Prof Paulo Lobato Correia 58
Fixed Channel Partitioning TDMA
TDMA ndash Time Division Multiple Access
Access to channel in roundsldquo
Each station gets fixed length slot (length = packet transmission time) in each round
Unused slots go idle
1 3 4 1 3 4
6-slotframe
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
21
RC ndash Prof Paulo Lobato Correia 59
TDMA
TDMA ndash Time Division Multiple Access
RC ndash Prof Paulo Lobato Correia 60
Fixed Channel Partitioning CDMA
CDMA ndash Code Division Multiple Access
Each user has access to the complete frequency band during all the time
Users are distinguished by using different codes
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
22
RC ndash Prof Paulo Lobato Correia 61
CDMA
RC ndash Prof Paulo Lobato Correia 62
Random Access Protocols
When node has packet to send
Transmit at full channel data rate R
No a priori coordination among nodes
Two or more transmitting nodes rarr ldquocollisionrdquo
Random access MAC protocol specifies
How to detect collisions
How to recover from collisions (eg via delayed retransmissions)
Examples of random access MAC protocols
ALOHA
Slotted ALOHA
CSMA CSMACD CSMACA
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
23
RC ndash Prof Paulo Lobato Correia 63
ALOHA
Created at the University of Hawaii in 1970
Aloha rarr simple no synchronization
Hosts transmit at channel rate
When frame is ready transmit immediately
Collision if two or more frames overlap (frames are lost)
If frame is lost schedule retransmission for a future instant
(randomly chosen)
t
retransmissionretransmission
collision duration
RC ndash Prof Paulo Lobato Correia 66
ALOHA Efficiency
Collisions
Frame sent at t0 collides with any other frames sent in [t0-LR t0+LR]
P (success by given node) = P (node transmits) P (no other transmission in [t0-LR t0+LR] )
t0 - LR t0 t0 + LR
( ) GekPsuccessP
sdotminus=== 20Vulnerability period
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
24
RC ndash Prof Paulo Lobato Correia 68
Slotted ALOHA
Assumptions
All frames of same size L
Time is divided into equal size slots (time to transmit 1 frame ndash LR)
Nodes start to transmit only at slot beginning
Nodes are synchronized
If 2 or more nodes transmit in a slot all nodes detect the collision
Operation
When node obtains 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 probability p until success
RC ndash Prof Paulo Lobato Correia 69
Slotted ALOHA
Pros
Single active node can continuously transmit at full channel rate
Highly decentralized only slot durations need to be in sync in every node
Simple
Cons
Collisions wasting slots
Idle slots
Nodes may be able to detect collision in less than time needed to transmit packet
Clock synchronization
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
25
RC ndash Prof Paulo Lobato Correia 71
Aloha Efficiency
10-3
10-2
10-1
100
101
102
0
005
01
015
02
025
03
035
04
Aloha
Sloted-AlohaE
ffic
iency
S
Offered load G
184
37
RC ndash Prof Paulo Lobato Correia 72
Carrier Sense Multiple Access (CSMA)
CSMA
Listen before transmit
If channel sensed idle rarr transmit entire frame
If channel sensed busy rarr defer transmission
Human analogy donrsquot interrupt others
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
26
RC ndash Prof Paulo Lobato Correia 73
CSMA Collisions
Collisions can still occur Propagation delay means two
nodes may not hear each otherrsquos
transmission
Collision
Entire packet transmission time
wasted
spatial layout of nodes
Note
Role of distance amp propagation delay
in determining collision probability
RC ndash Prof Paulo Lobato Correia 74
CSMACD (Collision Detection)
CSMACD
Carrier sensing deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted reducing channel wastage
Collision detection
Easy in wired LANs measure signal strengths compare transmitted received signals
Difficult in wireless LANs received signal strength overwhelmed by local transmission strength
Human analogy the polite conversationalist
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
27
RC ndash Prof Paulo Lobato Correia 75
CSMACD Collision Detection
RC ndash Prof Paulo Lobato Correia 76
Carrier Sense Multiple Access (CSMA)
Listen to the channel before transmission
If channel is busy postpone frame transmission
If channel is free immediately start frame transmission
Persistent CSMA
When channel is busy the station transmits as soon as it becomes idle
Non-persistent CSMA
When channel is busy the station schedules the frame transmission for a future moment randomly chosen
CSMACD
Stations involved in a collision stop their transmission as soon as the collision is detected
CSMACA
There may be ldquohiddenldquo stationshellip
obstacle
Collision
A
B
C
D
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
28
RC ndash Prof Paulo Lobato Correia 77
Dynamic Allocation MAC Protocols
Fixed channel partitioning MAC protocols
Share channel efficiently and fairly at high load
Inefficient at low load
bull Delay in channel access 1N bandwidth allocated
even if only 1 active node
Random access MAC protocols
Efficient at low load single node can fully utilize channel
High load collision overhead
Dynamic allocation (ldquotaking turnsrdquo) protocols
Look for best of both worlds
RC ndash Prof Paulo Lobato Correia 79
Dynamic Allocation Poll Select
A central (primary) computer controls the activity of the others
ACK Acknowledge
NAK Not Acknowledge
NAKrarr no information to send
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
29
RC ndash Prof Paulo Lobato Correia 81
Dynamic Allocation Token Passing
RC ndash Prof Paulo Lobato Correia 82
Summary of MAC Protocols
Channel partitioning by time frequency or code
Frequency Division Time Division Code Division
Random access (dynamic)
ALOHA S-ALOHA CSMA CSMACD
Carrier sensing easy in some technologies (wire) hard in others
(wireless)
CSMACD used in Ethernet
CSMACA used in 80211
Dynamic allocation (ldquotaking turnsrdquo)
Polling from central site token passing
Bluetooth FDDI IBM Token Ring
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
30
RC ndash Prof Paulo Lobato Correia 83
MAC Protocols
Comparing dynamic allocation with random access protocols
Dynamic allocation protocols allow a better channel usage at high loads
Random access protocols impose lower delays at low loads
Dynamic allocation protocols require central management or token management
Random access protocols need to be controlled against unstable behavior
RC ndash Prof Paulo Lobato Correia 84
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
31
RC ndash Prof Paulo Lobato Correia 85
IEEE 8023 ndash Ethernet
ldquoDominantrdquo wired LAN technology
Cheap lt $10 for NIC
First widely used LAN technology
Simpler cheaper than token LANs and ATM
Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
RC ndash Prof Paulo Lobato Correia 86
Star 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
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
32
RC ndash Prof Paulo Lobato Correia 87
Ethernet Frame Structure
Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame
Preamble
7 bytes with pattern 10101010 followed by one byte with pattern 10101011
Used to synchronize receiver and sender clock rates
RC ndash Prof Paulo Lobato Correia 88
Addresses 6 bytes
If adapter receives frame with matching destination address (or
broadcast address ndash eg ARP packet) it passes data in frame to
the network layer
Otherwise adapter discards frame
Type indicates higher layer protocol
Mostly IP but others possible eg Novell IPX AppleTalk
Ethernet Frame Structure
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
33
RC ndash Prof Paulo Lobato Correia 89
Data
MTU 46 to 1500 bytes
CRC
x32+ x26+ x23+ x22+ x16+ x12+ x11+ x10+ x8+ x7+ x5+ x4+ x2+ x+1
Checked at receiver ndash if error is detected the frame is dropped
Ethernet Frame Structure
RC ndash Prof Paulo Lobato Correia 90
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 in if application is using TCP
Otherwise application will see the gaps
Ethernetrsquos MAC protocol
Unslotted CSMACD
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
34
RC ndash Prof Paulo Lobato Correia 91
Ethernet CSMACD Algorithm
1 NIC receives datagram from network layer rarr creates frame
2 If channel idle (96 bit times) starts frame transmission
If channel busy waits until channel idle then transmits
3 If NIC transmits entire frame without detecting another transmission
rarr success
4 If NIC detects another transmission while transmitting
rarr aborts and sends jam signal (reinforce collision)
5 After aborting NIC enters exponential backoff
rarr After mth collision NIC chooses K at random from 012hellip2m-1
rarr NIC waits K512 bit times then returns to Step 2
RC ndash Prof Paulo Lobato Correia 92
Ethernetrsquos CSMACD
Jam Signal
Make sure all other transmitters are aware of collision rarr 48 bits
Bit time
01 micros for 10 Mbps Ethernet
Exponential Backoff
Goal adapt retransmission attempts to estimated load
Heavy load random wait will be longer
1st collision choose K from 01 delay is K 512 bit transmission times
After 2nd collision choose K from 0123hellip
After 10 collisions choose K from 01234hellip1023
(K=1023 rarr wait time is about 50 msec with 10 Mbps Ethernet)
httpmediapearsoncmgcomawaw_kurose_network_2appletscsmacdcsmacdhtml
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
35
RC ndash Prof Paulo Lobato Correia 94
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 10 Gbps
Different physical layer media fiber cable
applicationtransportnetwork
linkphysical
MAC protocoland frame format
100BASE-TX
100BASE-T4
100BASE-FX100BASE-T2
100BASE-SX 100BASE-BX
fiber physical layercopper (twisted pair) physical layer
RC ndash Prof Paulo Lobato Correia 95
Manchester encoding
Used in 10BaseT
Each bit has a transition
Allows clocks in sending and receiving nodes to synchronize to each other
No need for a centralized global clock among nodes
This is physical-layer material
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
36
RC ndash Prof Paulo Lobato Correia 96
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 97
Hubs
hellip physical-layer (ldquodumbrdquo) repeaters
Bits coming in one link go out in 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
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
37
RC ndash Prof Paulo Lobato Correia 98
Switch
Link-layer deviceSmarter than hubs takes active role
Stores forwards Ethernet frames
Examines incoming framersquos MAC address- Selectively forwards 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
RC ndash Prof Paulo Lobato Correia 99
SwitchAllows Multiple Simultaneous Transmissions
Hosts have dedicated direct
connection to switch
Switches buffer packets
Ethernet protocol used on each
incoming link but no collisions
full duplex
Each link is its own collision domain
Switching A-to-Arsquo and B-to-Brsquo
simultaneously without collisions
Not possible with dumb hub
A
Arsquo
B
Brsquo
C
Crsquo
switch with six interfaces(123456)
1 23
45
6
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
38
RC ndash Prof Paulo Lobato Correia 100
Switch Table
Q How does switch know that Arsquo is reachablevia interface 4 and Brsquo is reachable via interface 5
A Each switch has a switch table Entries contain(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 23
45
6
RC ndash Prof Paulo Lobato Correia 101
Switch Self-Learning
Switch learns which hosts can be reached through which interfaces
When frame is received switch ldquolearnsrdquo location of sender rarrincoming LAN segment
Records senderlocation pair in the switch table
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
6
A Arsquo
Source ADest Arsquo
MAC addr interface TTL
Switch table (initially empty)
A 1 60
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
39
RC ndash Prof Paulo Lobato Correia 102
Switch Frame FilteringForwarding
When frame received
1 Record link associated with sending host
2 Index switch table using MAC destination address
3 if entry found for destinationthen
if destination on segment from which frame arrivedthen drop the frame
else forward the frame on interface indicated
else flood
forward on all but the interface on which the frame arrived
RC ndash Prof Paulo Lobato Correia 103
Self-learning Forwarding Example
A
Arsquo
B
Brsquo
C
Crsquo
1 23
45
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 unknown
flood
Arsquo A
Destination is a known location
Arsquo 4 60
selective send
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
40
RC ndash Prof Paulo Lobato Correia 104
Interconnecting Switches
Switches can be connected together
A
B
Q Sending from A to G How does S1 know to forward frame destined to G via S4 and S3
A Self learning (Works exactly the same as in single-switch case)
S1
C D
E
FS2
S4
S3
H
I
G
RC ndash Prof Paulo Lobato Correia 105
Self-learning Multi-switch Example
Suppose C sends frame to I then I responds to C
Q Show switch tables and packet forwarding in S1 S2 S3 S4
A
B
S1
C D
E
FS2
S4
S3
H
I
G
1
2
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
41
RC ndash Prof Paulo Lobato Correia 106
Self-learning Example
Bridge 1
Estaccedilatildeo 1
Bridge 2
Estaccedilatildeo 2
Bridge 3
LAN A
LAN B LAN D
LAN E
LAN CP
P P P PP P P
Bridge 1 aprende o endereccedilo da estaccedilatildeo 1a partir do endereccedilo origem de P
P
P
flooding de P
R R R R RRR
Pflooding de P
R R
Bridge 2 aprende oendereccedilo da estaccedilatildeo 1
destino = 2 origem = 1pacote P destino = 1 origem = 2pacote R
1 12 2
Bridge 1 aprende o endereccediloda estaccedilatildeo 2
Bridge 2 aprende o endereccedilo da estaccedilatildeo 2a partir do endereccedilo origem de R
RC ndash Prof Paulo Lobato Correia 107
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
42
RC ndash Prof Paulo Lobato Correia 109
Redundant Topology
Networks introduce redundant links between switches or bridges to overcome the failure of links
These connections introduce physical loops into the network
Bridging loops are created so if one link fails another can take over the function of traffic forwarding
RC ndash Prof Paulo Lobato Correia 110
Redundant Topology
Switches flood traffic out all ports when the traffic is sent to a destination not yet known
Broadcast and multicast traffic is forwarded out on every port (except the port on which the traffic arrived)
This traffic can be caught in a loop
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
43
RC ndash Prof Paulo Lobato Correia 111
Redundant Topology
In Layer 2 header there is no Time To Live (TTL)
A frame sent into a Layer 2 looped topology of switches can loop foreverhellip (At Layer 3 the TTL is decremented and the packet is discarded when the TTL reaches 0)
This creates a dilemma
A physical topology that contains switching or bridging loops is necessary for reliability yet a switched network cannot have loops
RC ndash Prof Paulo Lobato Correia 112
Redundant Topology and Spanning Tree
Solution
Allow physical loops but create a loop free logical topology
Traffic destined to Cat-5 from any host attached to Cat-4 will travel through Cat-1 and Cat-2
This happens even if there is a direct physical connection between Cat-5 and Cat-4
The loop free logical topology created is called a tree and it has a star or extended star logical topology the spanning tree of the network
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
44
RC ndash Prof Paulo Lobato Correia 113
Spanning-Tree Protocol
Ethernet bridges and switches can implement the IEEE 8021D Spanning-Tree Protocol and use the spanning-tree algorithm to construct a loop free shortest path network
RC ndash Prof Paulo Lobato Correia 114
Spanning-Tree Protocol
Shortest path is based on cumulative link costs
Link costs are based on the speed of the link
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
45
RC ndash Prof Paulo Lobato Correia 115
Spanning-Tree Protocol
The Spanning-Tree Protocol establishes a root node called the
root bridge
The Spanning-Tree Protocol constructs a topology that has one path for reaching every network node
The resulting tree originates from the root bridge
Redundant links that are not part of the shortest path tree are blocked
RC ndash Prof Paulo Lobato Correia 117
Spanning-Tree Protocol
The message that a switch sends allowing the formation of a loop free logical topology is called a Bridge Protocol Data Unit (BPDU)
BPDUs continue to be received on blocked ports
This ensures that if an active path or device fails a new spanning tree can be calculated
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
46
RC ndash Prof Paulo Lobato Correia 118
Spanning-tree Operation
When the network has stabilized it has converged and there is one spanning tree per network
As a result for every switched network the following elements exist
One root bridge per network
Unused blocked ports
One root port per non root bridge
One designated port per network segment
RC ndash Prof Paulo Lobato Correia 119
Selecting the Root Bridge
When a switch is turned on the spanning-tree algorithm is used to identify the root bridge
BPDUs are sent out with the Bridge ID (BID)
The BID consists of a bridge priority that defaults to 32768 and the switch base MAC address
By default BPDUs are sent every two seconds
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
47
RC ndash Prof Paulo Lobato Correia 120
Selecting the Root Bridge
When a switch first starts up it assumes it is the root switch and sends ldquoinferiorrdquo BPDUs
These BPDUs contain the switch MAC address in both the root and sender BID
RC ndash Prof Paulo Lobato Correia 121
Selecting the Root Bridge
All switches see the BIDs sent
As a switch receives a BPDU with a lower root BID it replaces that in the BPDUs that are sent out
All bridges see these and decide that the bridge with the smallest BID value will be the root bridge
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
48
RC ndash Prof Paulo Lobato Correia 122
Selecting the Root Bridge
A network administrator may want to influence the decision by setting the switch priority to a smaller value than the default which will make the BID smaller
This should only be implemented when the traffic flow on the network is well understood
RC ndash Prof Paulo Lobato Correia 130
Conceitos baacutesicos spanning tree (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Porta raiz
Porta raizPorta raiz
Bridge raiz
Path costRoot path cost
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
Bridge
Designada
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
49
RC ndash Prof Paulo Lobato Correia 131
Conceitos baacutesicos spanning tree (II)
Bridge ID ndash cada bridge eacute identificada por um endereccedilo que conteacutem
2 octetos de prioridade configuraacutevel pelo gestor da rede +
6 octetos fixos (um dos endereccedilos MAC das portas da bridge ou qualquer outro endereccedilo uacutenico de 48 bits)
A prioridade tem precedecircncia sobre o campo de octetos fixos
Bridge raiz (Root Bridge) ndash bridge que estaacute na raiz da spanning tree bridge com menor Bridge ID
Path cost ndash custo associado a cada porta da bridge (pode ser configurado pelo gestor da rede)
RC ndash Prof Paulo Lobato Correia 132
Conceitos baacutesicos spanning tree (III) Bridge designada (Designated Bridge) ndash bridge que numa LAN eacute
responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa a bridge raiz eacute a bridge designada em todas as LANs a que estaacute ligada
Porta designada (Designated Port) ndash porta que numa LAN eacute responsaacutevel pelo envio de pacotes da LAN para a bridge raiz e vice-versa (uma das portas da bridge designada)
Bridge
Ethernet
Bridge
Bridge
pacotes deparaa bridge raiz
bridge designada
porta designada
Bridge
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
50
RC ndash Prof Paulo Lobato Correia 133
Conceitos baacutesicos spanning tree (IV)
Porta raiz (Root Port) ndash porta que numa bridge eacute responsaacutevel pela recepccedilatildeotransmissatildeo de pacotes depara a bridge raiz
Ethernet
pacotes deparaa bridge raiz
porta raiz
Bridge
Ethernet
Ethernet Ethernet
RC ndash Prof Paulo Lobato Correia 134
Conceitos baacutesicos spanning tree (V)
Cada bridge tem associado um custo do percurso para a raiz(Root Path Cost) igual agrave soma dos custos das portas que transmitem pacotes em direcccedilatildeo agrave bridge raiz (portas raiz) no percurso de menor custo para a bridge raiz
Bridge
Ethernet
Bridge
pacotes deparaa bridge raiz
portaraiz
Bridge
Bridge raiz
Ethernet
EthernetEthernet
100
20
30
20
20
portadesignada porta
raiz
Ethernet Ethernet
portaraiz
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
51
RC ndash Prof Paulo Lobato Correia 135
Conceitos baacutesicos spanning tree (VI)
A porta raiz eacute em cada bridge a porta que fornece o melhor percurso (de menor custo) para a raiz
A porta designada eacute em cada LAN a porta que fornece o melhor percurso para a raiz
As portas activas em cada bridge satildeo
a porta raiz + as portas designadas
As restantes portas ficam inactivas (blocked)
RC ndash Prof Paulo Lobato Correia 136
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (I)
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
52
RC ndash Prof Paulo Lobato Correia 137
16Eth 6
47Eth 5
93Eth 4
47Eth 3
12Eth 2
12Eth1
Bridges designadas
Exemplo ndash spanning tree (II)
RC ndash Prof Paulo Lobato Correia 138
138
BPDUs (Bridge Protocol Data Units)
Para construir e manter a spanning tree as bridges trocam mensagens especiais entre si designadas por Bridge Protocol Data Units (BPDUs)
Existem dois tipos Configuration e Topology Change Notification
bull Destination ndash endereccedilo multicast atribuiacutedo a todas as bridgesbull Source ndash endereccedilo MAC da porta que enviou a BPDUbull DSAP = SSAP = 01000010 = 42 hex
destination source DSAP SSAP BPDU
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
53
RC ndash Prof Paulo Lobato Correia 139
Configuration BPDUs
A configuraccedilatildeo da spanning tree eacute feita pelas Conf - BPDUs (mensagens de configuraccedilatildeo)
bull Campos mais importantes
Root ID estimativa actual do endereccedilo da bridge raiz
Root Path Cost estimativa actual do custo para a bridge raiz
Bridge ID endereccedilo da bridge que envia a mensagem de configuraccedilatildeo
Port ID endereccedilo da porta que envia a mensagem de configuraccedilatildeo
RC ndash Prof Paulo Lobato Correia 140
Manutenccedilatildeo da spanning tree
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
1501515015
151098 151098 152023 153018
Convenccedilatildeo para Conf-BPDUs
Root Bridge Root Path Cost Bridge ID
Peridiocidade das Conf-BPDUs = hello time
hello time recomendado 2 segundos
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
54
RC ndash Prof Paulo Lobato Correia 141
Ordenaccedilatildeo das mensagens de configuraccedilatildeo
Uma mensagem de configuraccedilatildeo C1 diz-se melhor que outra C2 se
o Root ID de C1 for inferior ao de C2
sendo os Root ID idecircnticos o Root Path Cost de C1 for inferior ao de C2
sendo idecircnticos o Root ID e o Root Path Cost o Bridge ID de C1 for inferior aode C2
sendo idecircnticos o Root ID o Root Path Cost e o Bridge ID o Port ID de C1 forinferior ao de C2
Root ID Root Path Cost Bridge ID Port ID
18 27 32 2
18 27 32 4
18 27 43 1
18 35 23 3
23 31 45 2
RC ndash Prof Paulo Lobato Correia 142
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (I)
Cada bridge assume inicialmente que eacute a bridge raiz (faz Root Path Cost = 0) envia mensagens de configuraccedilatildeo em todas as suas portas
92092
92092
92092
92092 92092
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
55
RC ndash Prof Paulo Lobato Correia 143
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (II)
4112111
411390
81081
4119125 4112315
41
4
12 + 1
melhores mensagens recebidas na Bridge 92 ateacute um dado instante
estimativas da Bridge 92
Bridge raiz =
Porta raiz =
Custo para a raiz =
RC ndash Prof Paulo Lobato Correia 144
Bridge 92
5
4
32
1
Bridge
Bridge
Bridge Bridge
Bridge
BridgeBridge
Construccedilatildeo da spanning tree (III)
4112111
41139081081
411392
4112315
mensagens enviadas pela Bridge 92 - 411392
411392
4119125
porta inactiva
porta inactiva
porta raiz
porta activa
porta activa
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
56
RC ndash Prof Paulo Lobato Correia 145
Construccedilatildeo da spanning tree (IV)
Bridge ID = 18
Bridge ID = 83
Bridge ID = 21Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 2Cost = 20
Port ID = 1Cost = 10
Port ID = 1Cost = 10
Port ID = 3Cost = 30
Port ID = 2Cost = 20
Eth 1
Eth 2
Eth 3
A bridge 83 envia 83083 em Eth1 Eth2 e Eth3
A bridge 21 envia 21021 em Eth2 e Eth3
A bridge 83 envia 212083 em Eth1 (porta raiz = 2)
A bridge 18 envia 18018 em Eth1 e Eth3
A bridge 21 envia 182021 em Eth2 (porta raiz = 2)
A bridge 83 envia 181083 em Eth2 (porta raiz = 1)
O algoritmo convergiu
A bridge raiz envia periodicamente 18018
A bridge 83 retransmite com 181083 em Eth2
bridge raiz
RC ndash Prof Paulo Lobato Correia 146
Avarias nas bridges ou nas LANs (I)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
Bridge raiz
15015message age = 0
15015message age = 0
151098message age = 0
151098message age = 0
152023message age = 0
153018message age = 0
protocol identifierversion
message type = 0reserved
root IDroot path cost
bridge IDport ID
message agemax age
hello timeforward delay
TCTCA
Conf-BPDU
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
57
RC ndash Prof Paulo Lobato Correia 147
Avarias nas bridges ou nas LANs (II)
Bridge ID = 15
Bridge ID = 98 Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
40
10 10
70
10
1020
2030
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
151098 age = 0 151098 age = 0
151098 age = 5 151098 age = 5
151098 age = max age 151098 age = max age
hellip hellip bull max age recomendado 20 segundos
Bridge 98 avaria
RC ndash Prof Paulo Lobato Correia 148
Avarias nas bridges ou nas LANs (III)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
77077message age = 0
77077message age = 0
Bridge 77 presume ser raiz
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
58
RC ndash Prof Paulo Lobato Correia 149
Avarias nas bridges ou nas LANs (IV)
Bridge ID = 15
Bridge ID = 23
Bridge ID = 44
Bridge ID = 18Bridge ID = 77
50 10
10 20
10
10 10
10
2020
30
15015message age = 0
15015message age = 0
152023message age = 0
153018message age = 0
153077message age = 0
152023message age = 0
Bridge 23 passa a designada nesta LAN
porta raiz
RC ndash Prof Paulo Lobato Correia 150
Existecircncia de ciclos temporaacuterios
Apoacutes alteraccedilatildeo da topologia da rede
pode existir perda temporaacuteria de conectividade se uma porta que estava inactiva na topologia antiga ainda natildeo se apercebeu que deveraacute estar activo na nova topologia
podem existir ciclos temporaacuterios se uma porta que estava activa na topologia antiga ainda natildeo se apercebeu que deveraacute estar inactiva na nova topologia
Para minimizar a probabilidade de se formarem ciclos temporaacuterios as bridges satildeo obrigadas a esperar algum tempo antes de permitirem que uma das suas portas passe do estado inactivo para o estado activo o tempo de espera eacute funccedilatildeo do paracircmetro forward delay
Bridge
Bridge
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
59
RC ndash Prof Paulo Lobato Correia 151
Tempo de vida das entradas das tabelas de encaminhamento
Tempo de vida demasiado longo ndash pode haver um nuacutemero exagerado de pacotes perdidos quando a estaccedilatildeo muda de localizaccedilatildeo
Tempo de vida demasiado curto ndash o traacutefego na rede pode ser exagerado devido ao processo de flooding
Existem dois tempos de vida
Longo usado por omissatildeo (valor recomendado = 5 minutos)
Curto usado quando a spanning tree estaacute em reconfiguraccedilatildeo (valor recomendado = 15 segundos) - exige processo de notificaccedilatildeo de alteraccedilotildees da topologia da rede
RC ndash Prof Paulo Lobato Correia 155
Formato mensagens de configuraccedilatildeo
protocol identifier
version
message type
reserved
root ID
cost of path to root
bridge ID
port ID
message age
max age
hello time
forward delay
TCTCA
2
1
1
1
8
4
8
2
2
2
2
2
octetos
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
60
RC ndash Prof Paulo Lobato Correia 160
Institutional Network
to externalnetwork
router
IP subnet
mail server
web server
RC ndash Prof Paulo Lobato Correia 161
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
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
61
RC ndash Prof Paulo Lobato Correia 162
Outline
Link-layer Addressing
Introduction and services
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 163
Elements of a Wireless Network
Network infrastructure
Wireless hosts Laptop Smartphone Tablet hellip
Run applications
May be stationary (non-mobile) or mobile
Wireless does not always mean mobility
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
62
RC ndash Prof Paulo Lobato Correia 164
Elements of a Wireless Network
Network infrastructure
Base station
Typically connected to the
wired network
Relay responsible for
sending packets between
wired network and wireless
host(s) in its ldquoareardquo
Eg cell towers 80211
access points
RC ndash Prof Paulo Lobato Correia 165
Elements of a Wireless Network
Network infrastructure
Wireless link
Typically used to connect
mobile(s) to base station
Also used as backbone link
Multiple access protocol coordinates link access
Various data rates
transmission distance
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
63
RC ndash Prof Paulo Lobato Correia 166
Elements of a Wireless Network
Network infrastructure
Infrastructure mode
Base station connects
mobiles into wired network
Handoff mobile changes
base station providing
connection into wired
network
RC ndash Prof Paulo Lobato Correia 167
Elements of a Wireless Network
Ad hoc mode
No base stations
Nodes can only transmit to
other nodes within link
coverage
Nodes organize themselves
into a network route among
themselves
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
64
RC ndash Prof Paulo Lobato Correia 169
Wireless Communications
Wireless communications are needed to Allow communications while moving
Allow communications in places where it is difficult or impossible to implement a cabled infrastructure
Allow broadcasting
Allow the fast implementation with low initial cost of a communications system
However Less controlled operation environment more subject to interference
noise unauthorized detection
Often provides lower transmission rates
The frequency bands are easier to reuse in guided media
Reflexions Dispersion DifractionShadow areas
RC ndash Prof Paulo Lobato Correia 170
Wireless Link Characteristics
Differences from wired link
Interference from other sources- Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) - Devices (motors) interfere as well
Multipath propagationRadio signal reflects off objects and ground arriving at destination at slightly different times
Decreased signal strengthRadio signal attenuates as it propagates through matter (path loss)
hellip make communication across (even a point to point) wireless link much more ldquodifficultrdquo
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
65
RC ndash Prof Paulo Lobato Correia 171
Wireless Link Characteristics
Signal-to-noise ratio (SNR)
Larger SNR ndash easier to extract signal from noise (a ldquogood thingrdquo)
SNR versus BER tradeoffs
Given physical layer
increase power -gt increase SNR-gt decrease BER
Given SNR choose physical layer that meets BER requirement giving highest throughput
bull SNR may change with mobility dynamically adapt physical layer (modulation technique rate)
10 20 30 40
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
RC ndash Prof Paulo Lobato Correia 172
Wireless Network Characteristics
Multiple wireless senders and receivers create additional problems (beyond multiple access)
AB
C
Hidden terminal problem B A hear each other
B C hear each other
A C can not hear each other
rarrrarrrarrrarr A C unaware of their interference at B
A B C
Arsquos signalstrength
space
Crsquos signalstrength
Signal attenuation B A hear each other
B C hear each other
A C can not hear each other interfering at B
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
66
RC ndash Prof Paulo Lobato Correia 176
IEEE 80211 Wireless LAN
80211b
24 - 5 GHz unlicensed spectrum up to 11 Mbps
80211a
5 - 6 GHz range up to 54 Mbps
80211g
24 - 5 GHz range up to 54 Mbps
80211n (multiple antennae)
24 - 5 GHz range (40 MHz channel) up to 150 Mbps
80211ac ndash under development (multiple antennae)
24 - 5 GHz range (80 or 160 MHz channel) gt 500 Mbps (up to 7 Gbps)
All use CSMACA for multiple access
All have base-station and ad-hoc network versions
RC ndash Prof Paulo Lobato Correia 177
Characteristics of Wireless Link Standards
Indoor10-30m
Outdoor50-200m
Mid-rangeoutdoor
200m ndash 4 Km
Long-rangeoutdoor
5Km ndash 20 Km
056
384
1
4
5-11
54
IS-95 CDMA GSM 2G
UMTSWCDMA CDMA2000 3G
80215
80211b
80211ag
UMTSWCDMA-HSPDA CDMA2000-1xEVDO 3G cellularenhanced
80216 (WiMAX)
80211ag point-to-point
200 80211n
Da
ta r
ate
(M
bp
s) data
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
67
RC ndash Prof Paulo Lobato Correia 179
80211 Channels Association
80211b 24GHz - 2485GHz spectrum divided into 11 channels at different
frequencies
AP administrator chooses frequency for AP
Interference possible Channel can be same as that chosen by neighboring AP
Host ndash must associate with an AP Scans channels listening for beacon frames containing APrsquos
name (SSID) and MAC address
Selects AP to associate with
May perform authentication
Will typically run DHCP to get IP address in APrsquos subnet
RC ndash Prof Paulo Lobato Correia 181
IEEE 80211 Multiple Access
Avoid collisions 2 or more nodes transmitting at same time
80211 CSMA - sense before transmitting
Donrsquot collide with ongoing transmission by other node
80211 no collision detection
Difficult to receive (sense collisions) when transmitting due to weak received
signals (fading)
Canrsquot sense all collisions in any case hidden terminal fading
Goal avoid collisions CSMACA (Collision Avoidance)
AB
CA B C
Arsquos signalstrength
space
Crsquos signalstrength
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
68
RC ndash Prof Paulo Lobato Correia 182
IEEE 80211 MAC Protocol CSMACA
80211 sender
1 If sense channel idle for DIFS then
- Transmit entire frame (no CD)
2 If sense channel busy then
- Start random backoff time
- Timer counts down while channel idle
- Transmit when timer expires
- If no ACK increase random backoff interval then repeat from 2
80211 receiver
- If frame received OK
- Return ACK after SIFS (ACK needed due to hidden terminal problem)
sender receiver
DIFS
data
SIFS
ACK
RC ndash Prof Paulo Lobato Correia 183
Avoiding Collisions (more)
IdeaAllow sender to ldquoreserverdquo channel rather than random access of data frames rarr avoid collisions of long data frames
Sender first transmits small request-to-send (RTS) packets to BS using CSMA
RTSs may still collide with each other (but theyrsquore short)
BS broadcasts clear-to-send CTS in response to RTS
CTS heard by all nodes
Sender transmits data frame
Other stations defer transmissions
Avoid data frame collisions completely using small reservation packets
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
69
RC ndash Prof Paulo Lobato Correia 184
Collision Avoidance RTS-CTS
APA B
time
DATA (A)
reservation collision
defer
RC ndash Prof Paulo Lobato Correia 185
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
80211 Frame Addressing
Address 2 MAC addressof wireless host or AP transmitting this frame(sender addr)
Address 1 MAC addressof wireless host or AP to receive this frame(wireless destination addr)
Address 3 MAC addressof router interface to which AP is attached (router addr)
Address 4 used only in ad hoc mode
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
70
RC ndash Prof Paulo Lobato Correia 186
Internetrouter
AP
H1 R1
AP MAC addr H1 MAC addr R1 MAC addr
address 1 address 2 address 3
80211 frame
R1 MAC addr H1 MAC addr
dest address source address
8023 frame
80211 Frame Addressing
RC ndash Prof Paulo Lobato Correia 187
framecontrol
durationaddress
1address
2address
4address
3payload CRC
2 2 6 6 6 2 6 0 - 2312 4
seqcontrol
TypeFromAP
SubtypeToAP
More frag
WEPMoredata
Powermgt
Retry RsvdProtocolversion
2 2 4 1 1 1 1 1 11 1
80211 Frame more
Duration of reserved transmission time (RTSCTS)
Frame seq
Frame type(RTS CTS ACK data)
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
71
RC ndash Prof Paulo Lobato Correia 189
80211 Advanced Capabilities
Rate Adaptation
Base station mobile - Dynamically change transmission rate (physical layer modulation technique) as mobile moves and SNR varies
QAM256 (8 Mbps)QAM16 (4 Mbps)BPSK (1 Mbps)
10 20 30 40SNR(dB)
BE
R
10-1
10-2
10-3
10-5
10-6
10-7
10-4
operating point
1 SNR decreases BER increase as node moves away from base station
2 When BER becomes too high switch to lower transmission rate but with lower BER
RC ndash Prof Paulo Lobato Correia 190
80211 Advanced Capabilities
Power Management
Node-to-AP ldquoI am going to sleep until next beacon framerdquo
AP knows not to transmit frames to this node
Node wakes up before next beacon frame
Beacon frame contains list of mobiles with AP-to-mobile frames
waiting to be sent
Node will stay awake if AP-to-mobile frames are to be sent
Otherwise sleep again until next beacon frame
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
72
RC ndash Prof Paulo Lobato Correia 191
Outline
Introduction and services
Link-layer Addressing
Error detection and correction
Multiple access protocols
Ethernet
Link-layer switches
IEEE 80211 Wireless LANs
Framing
RC ndash Prof Paulo Lobato Correia 192
Framing
Data Link layer
Frames include a header with synchronization addressing and control (type and frame number) information
Frames also include a trailer with error control and synchronization information
IP PacketData link layer
Network layer
Physical layer
IP datagram
DL -H DL -TIP datagram
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
73
RC ndash Prof Paulo Lobato Correia 193
Framing
Synchronization information is needed to know where each transmission begins and ends
1
2
3
4
5
6
X X
OLAacute BOM DIA
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGOE
QUANTO CUSTA O ARTIGO
OLAacute BQUANTOVOU CHOM DIA CUSTAEGAR D O ARTIE TARDGO E
VOU CHEGAR DE TARDE
RC ndash Prof Paulo Lobato Correia 194
Framing ldquoStuffingrdquo
Network layer data may contain binary patterns equal to those used for synchronization (flags) purposes in the data link layer
There is the need to avoid taking those IP data as a data link flag
To that purpose if the flag pattern appears in the IP data it should be preceded in the data link frame by a stuffing pattern to avoid any confusion
ESC escape byteByte
Stuffing
Used in the PPP
protocol
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
74
RC ndash Prof Paulo Lobato Correia 195
Byte Stuffing
ldquoData transparencyrdquo requirement data field must be allowed to
include flag pattern lt01111110gt
Q is received lt01111110gt data or flag
Sender adds (ldquostuffsrdquo) extra lt 01111110gt byte after each lt 01111110gt data byte
Receiver
Two 01111110 bytes in a row discard first byte continue data reception
Single 01111110 flag byte
RC ndash Prof Paulo Lobato Correia 196
Byte Stuffing
flag bytepatternin datato send
flag byte pattern plusstuffed byte in transmitted data
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
75
RC ndash Prof Paulo Lobato Correia 197
Example
Frame delimitation using the flag 0111 1110
Bit stuffing consists in
Add an extra 0 (b) after any sequence of five consecutive 1s in the data
field coming from the network layer (a) to avoid being taken for the flag
In the receptor the inverse operation takes place (c)
Framing ldquoStuffingrdquo
Bit
Stuffing
RC ndash Prof Paulo Lobato Correia 204
Summary
Principles behind data link layer services
Link layer addressing
Error detection correction
Sharing a broadcast channel multiple access
Instantiation and implementation of various link layer technologies
Ethernet
IEEE 80211 Wireless LANs
Switched LANS
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip
76
RC ndash Prof Paulo Lobato Correia 205
Summary
Journey down protocol stack complete (except PHY)
Solid understanding of networking principles and practice
hellip could stop here hellip but lots of interesting topics
Multimedia
Security
Network management hellip