Upload
thomas-doyle
View
218
Download
0
Tags:
Embed Size (px)
Citation preview
Week 1 1
Week 1Introduction and Data Link
Layer
Week 1 2
Layers OSI reference model Each layer communicates with its peer
layer through the use of a protocol The communication between n and n-1
is known as an interface
Week 1 3
Transmission
Week 1 4
Reception
Week 1 5
Layers Physical Layer
The physical later is concerned with transmitting raw bits over a communication channel
The design issues have to do with making sure that when one side sends a 1 bit it is received by the other side as a 1 bit not as a 0 bit
Typical questions here ar e how many volts should be used to represent a 1 and how many for a 0 how many microseconds a bit lasts whether transmission may proceed simultaneously in both directions how the initial connection is established and how it is torn down when both sides are finished and how many pins the network connector has and what each pin is used for
The design issues here deal largely with mechanical electrical and procedural interfaces and the physical transmission medium which lies below the physical layer Physical layer design can properly be considered to be within the domain of the electrical engineer
Examples RS232C X25 Ethernet
Week 1 6
Layers Data Link Layer
Sometimes called the link layer transmits chunks of information across a link
It deals with problems as checksumming to detect data corruption coordinating the use of shared media as in LAN (Local Area Network) and addressing (when multiple systems are reachable as in a LAN)
It is common for different links to implement different data link layers and for a node to support several data link layer protocols one for each of the types of links to which the node is attached
Example HDLC SDLC X25 Ethernet ATM
Week 1 7
Layers
Network Layer The network layer enables any pair of systems to
communicate with each other A fully connected network is one in which every pair
of nodes has a direct link between its nodes but this kind of topology does not scale beyond a few nodes
Network layer must find a path through a series of connected nodes and nodes along the path should forward packets in the appropriate direction
The network layer deals with problems such as route calculation packet assembly and reassembly (when different links on the path have different maximum packet sizes) and congestion control
Examples IP IPX ATM
Week 1 8
Layers
Transport Layer This layer provides a reliable
communications stream between a pair of systems
It deals with errors that can be introduced by the network layer such as lost packets duplicated packets packet reordering and fragmentation and reassembly
It is also nice if the transport layer reacts to congestion in the network
Example TCP
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 2
Layers OSI reference model Each layer communicates with its peer
layer through the use of a protocol The communication between n and n-1
is known as an interface
Week 1 3
Transmission
Week 1 4
Reception
Week 1 5
Layers Physical Layer
The physical later is concerned with transmitting raw bits over a communication channel
The design issues have to do with making sure that when one side sends a 1 bit it is received by the other side as a 1 bit not as a 0 bit
Typical questions here ar e how many volts should be used to represent a 1 and how many for a 0 how many microseconds a bit lasts whether transmission may proceed simultaneously in both directions how the initial connection is established and how it is torn down when both sides are finished and how many pins the network connector has and what each pin is used for
The design issues here deal largely with mechanical electrical and procedural interfaces and the physical transmission medium which lies below the physical layer Physical layer design can properly be considered to be within the domain of the electrical engineer
Examples RS232C X25 Ethernet
Week 1 6
Layers Data Link Layer
Sometimes called the link layer transmits chunks of information across a link
It deals with problems as checksumming to detect data corruption coordinating the use of shared media as in LAN (Local Area Network) and addressing (when multiple systems are reachable as in a LAN)
It is common for different links to implement different data link layers and for a node to support several data link layer protocols one for each of the types of links to which the node is attached
Example HDLC SDLC X25 Ethernet ATM
Week 1 7
Layers
Network Layer The network layer enables any pair of systems to
communicate with each other A fully connected network is one in which every pair
of nodes has a direct link between its nodes but this kind of topology does not scale beyond a few nodes
Network layer must find a path through a series of connected nodes and nodes along the path should forward packets in the appropriate direction
The network layer deals with problems such as route calculation packet assembly and reassembly (when different links on the path have different maximum packet sizes) and congestion control
Examples IP IPX ATM
Week 1 8
Layers
Transport Layer This layer provides a reliable
communications stream between a pair of systems
It deals with errors that can be introduced by the network layer such as lost packets duplicated packets packet reordering and fragmentation and reassembly
It is also nice if the transport layer reacts to congestion in the network
Example TCP
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 3
Transmission
Week 1 4
Reception
Week 1 5
Layers Physical Layer
The physical later is concerned with transmitting raw bits over a communication channel
The design issues have to do with making sure that when one side sends a 1 bit it is received by the other side as a 1 bit not as a 0 bit
Typical questions here ar e how many volts should be used to represent a 1 and how many for a 0 how many microseconds a bit lasts whether transmission may proceed simultaneously in both directions how the initial connection is established and how it is torn down when both sides are finished and how many pins the network connector has and what each pin is used for
The design issues here deal largely with mechanical electrical and procedural interfaces and the physical transmission medium which lies below the physical layer Physical layer design can properly be considered to be within the domain of the electrical engineer
Examples RS232C X25 Ethernet
Week 1 6
Layers Data Link Layer
Sometimes called the link layer transmits chunks of information across a link
It deals with problems as checksumming to detect data corruption coordinating the use of shared media as in LAN (Local Area Network) and addressing (when multiple systems are reachable as in a LAN)
It is common for different links to implement different data link layers and for a node to support several data link layer protocols one for each of the types of links to which the node is attached
Example HDLC SDLC X25 Ethernet ATM
Week 1 7
Layers
Network Layer The network layer enables any pair of systems to
communicate with each other A fully connected network is one in which every pair
of nodes has a direct link between its nodes but this kind of topology does not scale beyond a few nodes
Network layer must find a path through a series of connected nodes and nodes along the path should forward packets in the appropriate direction
The network layer deals with problems such as route calculation packet assembly and reassembly (when different links on the path have different maximum packet sizes) and congestion control
Examples IP IPX ATM
Week 1 8
Layers
Transport Layer This layer provides a reliable
communications stream between a pair of systems
It deals with errors that can be introduced by the network layer such as lost packets duplicated packets packet reordering and fragmentation and reassembly
It is also nice if the transport layer reacts to congestion in the network
Example TCP
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 4
Reception
Week 1 5
Layers Physical Layer
The physical later is concerned with transmitting raw bits over a communication channel
The design issues have to do with making sure that when one side sends a 1 bit it is received by the other side as a 1 bit not as a 0 bit
Typical questions here ar e how many volts should be used to represent a 1 and how many for a 0 how many microseconds a bit lasts whether transmission may proceed simultaneously in both directions how the initial connection is established and how it is torn down when both sides are finished and how many pins the network connector has and what each pin is used for
The design issues here deal largely with mechanical electrical and procedural interfaces and the physical transmission medium which lies below the physical layer Physical layer design can properly be considered to be within the domain of the electrical engineer
Examples RS232C X25 Ethernet
Week 1 6
Layers Data Link Layer
Sometimes called the link layer transmits chunks of information across a link
It deals with problems as checksumming to detect data corruption coordinating the use of shared media as in LAN (Local Area Network) and addressing (when multiple systems are reachable as in a LAN)
It is common for different links to implement different data link layers and for a node to support several data link layer protocols one for each of the types of links to which the node is attached
Example HDLC SDLC X25 Ethernet ATM
Week 1 7
Layers
Network Layer The network layer enables any pair of systems to
communicate with each other A fully connected network is one in which every pair
of nodes has a direct link between its nodes but this kind of topology does not scale beyond a few nodes
Network layer must find a path through a series of connected nodes and nodes along the path should forward packets in the appropriate direction
The network layer deals with problems such as route calculation packet assembly and reassembly (when different links on the path have different maximum packet sizes) and congestion control
Examples IP IPX ATM
Week 1 8
Layers
Transport Layer This layer provides a reliable
communications stream between a pair of systems
It deals with errors that can be introduced by the network layer such as lost packets duplicated packets packet reordering and fragmentation and reassembly
It is also nice if the transport layer reacts to congestion in the network
Example TCP
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 5
Layers Physical Layer
The physical later is concerned with transmitting raw bits over a communication channel
The design issues have to do with making sure that when one side sends a 1 bit it is received by the other side as a 1 bit not as a 0 bit
Typical questions here ar e how many volts should be used to represent a 1 and how many for a 0 how many microseconds a bit lasts whether transmission may proceed simultaneously in both directions how the initial connection is established and how it is torn down when both sides are finished and how many pins the network connector has and what each pin is used for
The design issues here deal largely with mechanical electrical and procedural interfaces and the physical transmission medium which lies below the physical layer Physical layer design can properly be considered to be within the domain of the electrical engineer
Examples RS232C X25 Ethernet
Week 1 6
Layers Data Link Layer
Sometimes called the link layer transmits chunks of information across a link
It deals with problems as checksumming to detect data corruption coordinating the use of shared media as in LAN (Local Area Network) and addressing (when multiple systems are reachable as in a LAN)
It is common for different links to implement different data link layers and for a node to support several data link layer protocols one for each of the types of links to which the node is attached
Example HDLC SDLC X25 Ethernet ATM
Week 1 7
Layers
Network Layer The network layer enables any pair of systems to
communicate with each other A fully connected network is one in which every pair
of nodes has a direct link between its nodes but this kind of topology does not scale beyond a few nodes
Network layer must find a path through a series of connected nodes and nodes along the path should forward packets in the appropriate direction
The network layer deals with problems such as route calculation packet assembly and reassembly (when different links on the path have different maximum packet sizes) and congestion control
Examples IP IPX ATM
Week 1 8
Layers
Transport Layer This layer provides a reliable
communications stream between a pair of systems
It deals with errors that can be introduced by the network layer such as lost packets duplicated packets packet reordering and fragmentation and reassembly
It is also nice if the transport layer reacts to congestion in the network
Example TCP
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 6
Layers Data Link Layer
Sometimes called the link layer transmits chunks of information across a link
It deals with problems as checksumming to detect data corruption coordinating the use of shared media as in LAN (Local Area Network) and addressing (when multiple systems are reachable as in a LAN)
It is common for different links to implement different data link layers and for a node to support several data link layer protocols one for each of the types of links to which the node is attached
Example HDLC SDLC X25 Ethernet ATM
Week 1 7
Layers
Network Layer The network layer enables any pair of systems to
communicate with each other A fully connected network is one in which every pair
of nodes has a direct link between its nodes but this kind of topology does not scale beyond a few nodes
Network layer must find a path through a series of connected nodes and nodes along the path should forward packets in the appropriate direction
The network layer deals with problems such as route calculation packet assembly and reassembly (when different links on the path have different maximum packet sizes) and congestion control
Examples IP IPX ATM
Week 1 8
Layers
Transport Layer This layer provides a reliable
communications stream between a pair of systems
It deals with errors that can be introduced by the network layer such as lost packets duplicated packets packet reordering and fragmentation and reassembly
It is also nice if the transport layer reacts to congestion in the network
Example TCP
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 7
Layers
Network Layer The network layer enables any pair of systems to
communicate with each other A fully connected network is one in which every pair
of nodes has a direct link between its nodes but this kind of topology does not scale beyond a few nodes
Network layer must find a path through a series of connected nodes and nodes along the path should forward packets in the appropriate direction
The network layer deals with problems such as route calculation packet assembly and reassembly (when different links on the path have different maximum packet sizes) and congestion control
Examples IP IPX ATM
Week 1 8
Layers
Transport Layer This layer provides a reliable
communications stream between a pair of systems
It deals with errors that can be introduced by the network layer such as lost packets duplicated packets packet reordering and fragmentation and reassembly
It is also nice if the transport layer reacts to congestion in the network
Example TCP
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 8
Layers
Transport Layer This layer provides a reliable
communications stream between a pair of systems
It deals with errors that can be introduced by the network layer such as lost packets duplicated packets packet reordering and fragmentation and reassembly
It is also nice if the transport layer reacts to congestion in the network
Example TCP
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 9
Layers Session Layer
The session layer assumes that a reliable virtual point-to-point connection has been made and contains specs for the dialog between the two end systems such as dialog discipline data grouping and recovery of an interrupted session Specs are also included for initiating and concluding a session Many network specs contain little or no session specs and leave these decisions to the applications
Presentation Layer Provides transformation of data to standardize the application
interface Also provides some network services such as encryption compression and text re-formatting
Application Layer This layer plays the same role as the application interface in
operating systems Provides network services to users (applications) of the network in a distributed processing environment examples transaction server file transfer protocol network management electronic mail and terminal access to remote applications
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 10
PDUs and SDUs
PSDU
SSDU
TSDU
NSDU
LSDU
PhSDU
PhPDU
LPDU
NPDU
TPDU
SPDU
PPDU
APDUApplication
Presentation
Session
Transport
Network
Data Link
Physical
Application
Presentation
Session
Transport
Network
Data Link
Physical
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 11
Service Models
Layer n-1 can provide either a connectionless service or connection-oriented service Communication consists of three phases in a
CO-servicebull Connection setupbull Data transferbull Connnection release
Associated with each of these phases are two functions
bull Layer n initiates the functionbull Layer n-1 informs layer n that some layer n process
in some other node is requesting a connection
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 12
Service Models
Services can vary in their degree of reliability Datagram service (also known as best-
effort) accepts data but makes no guarantees as to delivery in that data may be lost duplicated delivered out of order or mangled
A reliable service guarantees the data will be delivered in the order transmitted without corrupting duplication or loss
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 13
ExamplesService Connection-
orientedConnectionless
Datagram ATM IP IPX DECnet
Reliable X25
bull In the TCPIP protocol suite network layer is connectionless TCP offers reliable connection-oriented service UDPs datagram servicebull ATM offers a connection-oriented unreliable service that can be viewed as a network layer For IP over ATM ATM is viewed by IP as a a data link layerbull Itrsquos good to know about layering but it should not be taken that seriously however it is a good learning and communication tool
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 14
Internet protocol stack
application supporting network applications ftp smtp http
transport host-host data transfer tcp udp
network routing of datagrams from source to destination ip routing protocols
link data transfer between neighboring network elements ppp ethernet
physical bits ldquoon the wirerdquo
application
transport
network
link
physical
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 15
TCPIP Stack
Application
Presentation
Session
Transport
Network
Data Link
Physical
Transport TCP UDP
Link
Application
Internet
OSI Reference
Model
TCPIP
Stack
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 16
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
Each layer Distributed
ldquoentitiesrdquo implement layer functions at each node
entities perform actions exchange messages with peers
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 17
Layering logical communication
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
networklink
physical
data
data
Eg transport take data from
app add addressing
reliability check info to form ldquodatagramrdquo
send datagram to peer
wait for peer to ack receipt
data
transport
transport
ack
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 18
Protocol layering and dataEach layer takes data from above adds header information to create new
data unit passes new data unit to layer below
applicationtransportnetwork
linkphysical
applicationtransportnetwork
linkphysical
source destination
M
M
M
M
Ht
HtHn
HtHnHl
M
M
M
M
Ht
HtHn
HtHnHl
message
segment
datagram
frame
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 19
Internet structure network of networks roughly hierarchical nationalinternational
backbone providers (NBPs) eg BBNGTE Sprint ATampT
IBM UUNet interconnect (peer) with each
other privately or at public Network Access Point (NAPs)
regional ISPs connect into NBPs
local ISP company connect into regional ISPs
NBP A
NBP B
NAP NAP
regional ISP
regional ISP
localISP
localISP
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 20
Tiered Networks
A Tier 1 Network is an IP network which connects to the entire Internet solely via Settlement Free Interconnection commonly known as peering Tier 1 - A network that peers with every
other network to reach the Internet Tier 2 - A network that peers with some
networks but still purchases IP transit to reach at least some portion of the Internet
Tier 3 - A network that solely purchases transit from other networks to reach the Internet
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 21
Routing
In commercial network routing between autonomous systems hot-potato routing is the practice of passing traffic off to another AS as quickly as possible thus using their network for wide-area transit
Cold-potato routing is the opposite where the originating AS holds onto the packet until it is as near to the destination as possible
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 22
Global Backbone Provider
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 23
Important Properties of a Network Scope - A network architecture should solve as general a
problem as possible Scalability - Would work well with very large networks and be
also efficient with small networks Robustness The network should continue to operate
even if nodes or links fail Safety barriers A fault does not spread beyond a safety
barrier for example a router confines a broadcast storm to a single LAN
Self-stabilization After a failure the network will return to normal operation without human intervention within a reasonable time eg routing protocols
Fault detection Autoconfigurability Tweakability Migration
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 24
How A new network philosophy and architecture is
replacing the vision of an Intelligent Network The vision is one in which the public communications network would be engineered for always-on use not intermittence and scarcity It would be engineered for intelligence at the end-users device not in the network
And the network would be engineered simply to Deliver the Bits not for fancy network routing Fundamentally it would be a Stupid Network
In the Stupid Network the data would tell the network where it needs to go (In contrast in a circuit network the network tells the data where to go) In a Stupid Network the data on it would be the boss
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 25
Scope of this Course We will study how a packet finds its way from a
source to a destination Role of Layer 2
bull Ethernet PPP 80211 Role of Layer 3
bull IP Addressingbull Routingbull OSPF BGP
Internet architecture
We will also study emerging trends in IP networks IP QoS MPLS (Multiprotocol Label Switching) Traffic Engineering Multimedia networking
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 26
The Data Link Layer
Our goals understand principles behind data link layer
services error detection correction sharing a broadcast channel multiple access link layer addressing reliable data transfer flow control
instantiation and implementation of various link layer technologies
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 27
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM and MPLS
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 28
Link Layer IntroductionSome 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 frame encapsulates datagram
ldquolinkrdquo
data-link layer has responsibility of transferring datagram from one node to adjacent node over a link
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 29
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 Princeton to
Lausanne limo Princeton to JFK plane JFK to Geneva train Geneva to Lausanne
tourist = datagram transport segment =
communication link transportation mode =
link layer protocol travel agent = routing
algorithm
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 30
Link Layer Services Framing link access
encapsulate datagram into frame adding header trailer
channel access if shared medium ldquoMACrdquo addresses used in frame headers to identify
source dest bull different from IP address
Reliable delivery between adjacent nodes seldom used on low bit error link (fiber some twisted
pair) wireless links high error rates
bull Q why both link-level and end-end reliability
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 31
Link Layer Services (more)
Flow Control pacing between adjacent sending and receiving nodes
Error Detection errors caused by signal attenuation noise receiver detects presence of errors
bull signals sender for retransmission or drops frame
Error Correction receiver identifies and corrects bit error(s) without
resorting to retransmission
Half-duplex and full-duplex with half duplex nodes at both ends of link can
transmit but not at same time
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 32
Adaptors Communicating
link layer implemented in ldquoadaptorrdquo (aka NIC) Ethernet card PCMCI card
80211 card
sending side encapsulates datagram in
a frame adds error checking bits
rdt flow control etc
receiving side looks for errors rdt flow
control etc extracts datagram
passes to rcving node
adapter is semi-autonomous
link amp physical layers
sendingnode
frame
rcvingnode
datagram
frame
adapter adapter
link layer protocol
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 33
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 34
Error DetectionEDC= Error Detection and Correction bits (redundancy)D = Data protected by error checking may include header fields
bull Error detection not 100 reliablebull protocol may miss some errors but rarelybull larger EDC field yields better detection and correction
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 35
Parity Checking
Single Bit ParityDetect single bit errors
Two Dimensional Bit ParityDetect and correct single bit errors
0 0
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 36
Checksumming Cyclic Redundancy Check view data bits D as a binary number choose r+1 bit pattern (generator) G goal choose r CRC bits R such that
ltDRgt exactly divisible by G (modulo 2) receiver knows G divides ltDRgt by G If non-zero
remainder error detected can detect all burst errors less than r+1 bits
widely used in practice (ATM HDCL)
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 37
CRC ExampleWant
D2r XOR R = nGequivalently
D2r = nG XOR R equivalently if we divide D2r by
G want remainder R
R = remainder[ ]D2r
G
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 38
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 39
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) traditional Ethernet upstream HFC 80211 wireless LAN
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 40
Multiple Access protocols single shared broadcast channel two or more simultaneous transmissions by nodes
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 channel itself no out-of-band channel for coordination
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 41
Ideal Mulitple Access Protocol
Broadcast channel of rate R bps1 When one node wants to transmit it can send
at rate R2 When M nodes want to transmit each can
send at average rate RM3 Fully decentralized
no special node to coordinate transmissions no synchronization of clocks slots
4 Simple
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 42
MAC Protocols a taxonomy
Three broad classes Channel Partitioning
divide channel into smaller ldquopiecesrdquo (time slots frequency code)
allocate piece to node for exclusive use
Random Access channel not divided allow collisions ldquorecoverrdquo from collisions
ldquoTaking turnsrdquo Nodes take turns but nodes with more to send can
take longer turns
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 43
Channel Partitioning MAC protocols TDMA
TDMA time division multiple access access to channel in rounds each station gets fixed length slot (length = pkt trans time) in each round unused slots go idle example 6-station LAN 134 have pkt slots 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 44
Channel Partitioning MAC protocols FDMA
FDMA frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example 6-station LAN 134 have pkt frequency bands 256 idle
TDM (Time Division Multiplexing) channel divided into N time slots one per user inefficient with low duty cycle users and at light load
FDM (Frequency Division Multiplexing) frequency subdivided
frequ
ency
bands time
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 45
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 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 slotted ALOHA ALOHA CSMA CSMACD CSMACA
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 46
Slotted ALOHA
Assumptions all frames same size time is divided into
equal size slots time to transmit 1 frame
nodes start to transmit frames only at beginning of slots
nodes are synchronized if 2 or more nodes
transmit in slot all nodes detect collision
Operation when node obtains fresh
frame it transmits in next slot
no collision node can send new frame in next slot
if collision node retransmits frame in each subsequent slot with prob p until success
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 47
Slotted ALOHA
Pros single active node can
continuously transmit at full rate of channel
highly decentralized only slots in nodes need to be in sync
simple
Cons collisions wasting
slots idle slots nodes may be able to
detect collision in less than time to transmit packet
clock synchronization
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 48
Slotted Aloha efficiency
Suppose N nodes with many frames to send each transmits in slot with probability p
prob that node 1 has success in a slot = p(1-p)N-1
prob that any node has a success = Np(1-p)N-1
For max efficiency with N nodes find p that maximizes Np(1-p)N-1
For many nodes take limit of Np(1-p)N-1
as N goes to infinity gives 1e = 37
Efficiency is the long-run fraction of successful slots when there are many nodes each with many frames to send
At best channelused for useful transmissions 37of time
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 49
CSMA (Carrier Sense Multiple Access)
CSMA listen before transmitIf channel sensed idle transmit entire frame If channel sensed busy defer transmission
Human analogy donrsquot interrupt others
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 50
CSMA collisions
collisions can still occurpropagation delay means two nodes may not heareach otherrsquos transmissioncollisionentire packet transmission time wasted
spatial layout of nodes
noterole of distance amp propagation delay in determining collision probability
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 51
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 receiver shut off while transmitting
human analogy the polite conversationalist
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 52
CSMACD collision detection
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 53
ldquoTaking Turnsrdquo MAC protocolschannel partitioning MAC protocols
share channel efficiently and fairly at high load
inefficient at low load 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
ldquotaking turnsrdquo protocolslook for best of both worlds
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 54
ldquoTaking Turnsrdquo MAC protocolsPolling master node
ldquoinvitesrdquo slave nodes to transmit in turn
concerns polling overhead latency single point of
failure (master)
Token passing control token passed
from one node to next sequentially
token message concerns
token overhead latency single point of failure
(token)
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 55
Summary of MAC protocols
What do you do with a shared media Channel Partitioning by time frequency or
codebull Time Division Frequency Division
Random partitioning (dynamic) bull ALOHA S-ALOHA CSMA CSMACDbull carrier sensing easy in some technologies (wire)
hard in others (wireless)bull CSMACD used in Ethernetbull CSMACA used in 80211
Taking Turnsbull polling from a central site token passing
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 56
LAN technologies
Data link layer so far services error detectioncorrection multiple
access
Next LAN technologies addressing Ethernet hubs switches PPP
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 57
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 58
MAC Addresses and ARP
32-bit IP address network-layer address used to get datagram to destination IP subnet
MAC (or LAN or physical or Ethernet) address used to get datagram from one interface to
another physically-connected interface (same network)
48 bit MAC address (for most LANs) burned in the adapter ROM
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 59
LAN Addresses and ARPEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 60
LAN Address (more)
MAC address allocation administered by IEEE manufacturer buys portion of MAC address
space (to assure uniqueness) Analogy (a) MAC address like Social Security
Number (b) IP address like postal address MAC flat address portability
can move LAN card from one LAN to another
IP hierarchical address NOT portable depends on IP subnet to which node is attached
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 61
ARP Address Resolution Protocol
Each IP node (Host Router) on LAN has ARP table
ARP Table IPMAC address mappings for some LAN nodes
lt IP address MAC address TTLgt
TTL (Time To Live) time after which address mapping will be forgotten (typically 20 min)
Question how to determineMAC address of Bknowing Brsquos IP address
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN
237196723
237196778
237196714
237196788
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 62
ARP protocol Same LAN (network) A wants to send datagram
to B and Brsquos MAC address not in Arsquos ARP table
A broadcasts ARP query packet containing Bs IP address Dest MAC address = FF-
FF-FF-FF-FF-FF all machines on LAN
receive ARP query B receives ARP packet
replies to A with its (Bs) MAC address frame sent to Arsquos MAC
address (unicast)
A caches (saves) IP-to-MAC address pair in its ARP table until information becomes old (times out) soft state information
that times out (goes away) unless refreshed
ARP is ldquoplug-and-playrdquo nodes create their ARP
tables without intervention from net administrator
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 63
Routing to another LANwalkthrough send datagram from A to B via R assume A knowrsquos B IP address
Two ARP tables in router R one for each IP network (LAN)
In routing table at source Host find router 111111111110 In ARP table at source find MAC address E6-E9-00-17-BB-4B etc
A
RB
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 64
A creates datagram with source A destination B A uses ARP to get Rrsquos MAC address for 111111111110 A creates link-layer frame with Rs MAC address as dest
frame contains A-to-B IP datagram Arsquos adapter sends frame Rrsquos adapter receives frame R removes IP datagram from Ethernet frame sees its
destined to B R uses ARP to get Brsquos MAC address R creates frame containing A-to-B IP datagram sends to B
A
RB
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 65
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Hubs and switches 57 PPP 58 Link Virtualization
ATM
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 66
Ethernet
ldquodominantrdquo wired LAN technology cheap $20 for 100Mbs first widely used LAN technology Simpler cheaper than token LANs and ATM Kept up with speed race 10 Mbps ndash 10 Gbps
Metcalfersquos Ethernetsketch
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 67
Star topology
Bus topology popular through mid 90s Now star topology prevails Connection choices hub or switch (more later)
hub orswitch
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 68
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 sender clock
rates
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 69
Ethernet Frame Structure (more) Addresses 6 bytes
if adapter receives frame with matching destination address or with broadcast address (eg ARP packet) it passes data in frame to net-layer protocol
otherwise adapter discards frame
Type indicates the higher layer protocol (mostly IP but others may be supported such as Novell IPX and AppleTalk)
CRC checked at receiver if error is detected the frame is simply dropped
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 70
Unreliable connectionless service Connectionless No handshaking between
sending and receiving adapter Unreliable receiving adapter doesnrsquot send
acks or nacks to sending adapter stream of datagrams passed to network layer can
have gaps gaps will be filled if app is using TCP otherwise app will see the gaps
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 71
Ethernet uses CSMACD
No slots adapter doesnrsquot
transmit if it senses that some other adapter is transmitting that is carrier sense
transmitting adapter aborts when it senses that another adapter is transmitting that is collision detection
Before attempting a retransmission adapter waits a random time that is random access
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 72
Ethernet CSMACD algorithm
1 Adaptor receives datagram from net layer amp creates frame
2 If adapter senses channel idle it starts to transmit frame If it senses channel busy waits until channel idle and then transmits
3 If adapter transmits entire frame without detecting another transmission the adapter is done with frame
4 If adapter detects another transmission while transmitting aborts and sends jam signal
5 After aborting adapter enters exponential backoff after the mth collision adapter chooses a K at random from 012hellip2m-1 Adapter waits K512 bit times and returns to Step 2
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 73
Ethernetrsquos CSMACD (more)
Jam Signal make sure all other transmitters are aware of collision 48 bits
Bit time 1 microsec for 10 Mbps Ethernet for K=1023 wait time is about 50 msec
Exponential Backoff Goal adapt retransmission
attempts to estimated current load heavy load random wait
will be longer first collision choose K
from 01 delay is K 512 bit transmission times
after second collision choose K from 0123hellip
after ten collisions choose K from 01234hellip1023
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 74
CSMACD efficiency Tprop = max prop between 2 nodes in LAN
ttrans = time to transmit max-size frame
Efficiency goes to 1 as tprop goes to 0
Goes to 1 as ttrans goes to infinity Much better than ALOHA but still decentralized simple and cheap
transprop tt 51
1efficiency
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 75
Link Layer
51 Introduction and services
52 Error detection and correction
53Multiple access protocols
54 Link-Layer Addressing
55 Ethernet
56 Interconnections Hubs and switches
57 PPP 58 Link Virtualization
ATM
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 76
HubsHubs are essentially physical-layer repeaters
bits coming from one link go out all other links at the same rate no frame buffering no CSMACD at hub adapters detect collisions provides net management functionality
twisted pair
hub
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 77
Interconnecting with hubs Backbone hub interconnects LAN segments Extends max distance between nodes But individual segment collision domains become one large
collision domain Canrsquot interconnect 10BaseT amp 100BaseT
hub
hubhub
hub
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 78
Switch Link layer device
stores and forwards Ethernet frames examines frame header and selectively forwards
frame based on MAC dest address when frame is to be forwarded on segment uses
CSMACD to access segment transparent
hosts are unaware of presence of switches plug-and-play self-learning
switches do not need to be configured
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 79
Forwarding
bull How do determine onto which LAN segment to forward framebull Looks like a routing problem
hub
hubhub
switch1
2 3
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 80
Self learning
A switch has a switch table entry in switch table
(MAC Address Interface Time Stamp) stale entries in table dropped (TTL can be 60
min) switch learns which hosts can be reached through
which interfaces when frame received switch ldquolearnsrdquo location
of sender incoming LAN segment records senderlocation pair in switch table
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 81
FilteringForwardingWhen switch receives a frame
index switch table using MAC dest addressif entry found for destination
then if dest on segment from which frame arrived
then drop the frame else forward the frame on interface indicated else flood
forward on all but the interface on which the frame arrived
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 82
Switch example
Suppose C sends frame to D
Switch receives frame from from C notes in bridge table that C is on interface 1 because D is not in table switch forwards frame into
interfaces 2 and 3
frame received by D
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEG
1123
12 3
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 83
Switch example
Suppose D replies back with frame to C
Switch receives frame from from D notes in bridge table that D is on interface 2 because C is in table switch forwards frame only to
interface 1
frame received by C
hub
hub hub
switch
A
B CD
EF
G H
I
address interface
ABEGC
11231
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 84
Switch traffic isolation switch installation breaks subnet into LAN
segments switch filters packets
same-LAN-segment frames not usually forwarded onto other LAN segments
segments become separate collision domains
hub hub hub
switch
collision domain collision domain
collision domain
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 85
Switches dedicated access Switch with many
interfaces Hosts have direct
connection to switch No collisions full duplex
Switching A-to-Arsquo and B-to-Brsquo simultaneously no collisions
switch
A
Arsquo
B
Brsquo
C
Crsquo
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 86
More on Switches
cut-through switching frame forwarded from input to output port without first collecting entire frameslight reduction in latency
combinations of shareddedicated 101001000 Mbps interfaces
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 87
Institutional network
hub
hubhub
switch
to externalnetwork
router
IP subnet
mail server
web server
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 88
How does the IP router different from an Ethernet switch
IP Router
PCs with EthernetNetwork Interface Cards (NICs)
Host C
An IP Router is a packet switch whose line cards demutliplex out IP datagrams and forward packets based on destination IP address and routing table entries
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 89
IP Router vs Ethernet Switch
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 90
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Exact match of destination MAC address of
incoming packet with destination column entry in routing table
bull If there is no match flood packet to all ports in the forwarding state
IP routerbull Longest-prefix match - notion of subnet maskbull Default entry matchbull If no default entry drop packet
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 91
Difference between Ethernet switch and IP router Data plane - as packets arrive
Ethernet switchbull Does not change MAC header
IP routerbull Fields in the IP header are changed such as TTL
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 92
Difference between Ethernet switch and IP router Addressing
Ethernet switchbull Flat 6-byte addressingbull Routing tables will be very large because of flat
addressing IP router
bull Hierarchical 4-byte (IPv4) and 16-byte (IPv6)bull Advantage address summarization used to
decrease the number of entries in the routing table
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 93
Difference between Ethernet switch and IP router Routing protocol
Ethernet switchbull Address learningbull Spanning tree algorithm - default ports
IP routerbull OSPF link-state protocolbull RIP BGP distance-vector protocols
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 94
Difference between Ethernet switch and IP router Ethernet switches
Characteristics like flooding packets and flat addressing makes these packet switches
bull Suitable for Local Area Networks (LANs)bull Hence used within enterprises
IP routers Characteristics like default entry and
hierarchical addressing (with subnet masks) makes these packet switches
bull Suitable for Wide Area Networks (WANs)
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 95
An important difference between Ethernet switch and IP router
Ethernet switches Plug-and-play MAC addresses are hardwired into
interfaces (NICs and switches links) IP routers
Needs some administrationbull Configure IP addresses of interfacesbull Default router setting
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 96
Routing protocol in Ethernet switches
(IEEE 8021D)
Address learning Spanning tree algorithmTwo points to note
The word bridge is used here since these protocols are run on generic bridges (that interconnect any two types of IEEE 802 LANs)
bull Current-day interest Ethernet switches run this protocol
A network with a hub is shown as a single line Assume that multiple hosts are connected to each hub
M Veeraraghavan (originals by J Liebeherr)
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 97
Operation of transparent bridges Three aspects of bridge (switch) operation
(1) Forwarding of Frames (2) Learning of Addresses(3) Spanning Tree Algorithm
Bridges that run spanning-tree algorithm and have address learning are essentially connectionless packet switches because they perform packet forwarding from one link to another based on destination addresses carried in the headers of incoming packets use the term ldquobridgerdquo and ldquoswitchrdquo interchangeably use the term ldquoframerdquo and ldquopacketrdquo interchangeably
The term ldquotransparentrdquo refers to the fact that the hosts are completely unaware of the presence of bridges in the network Introduction of a bridge does not require hosts to be
configured
Use to create entries for the routing table (distributed scheme routing protocol)
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 98
Routing table (called filtering database in Ethernet switches)
Each bridge maintains a filtering database (routing table) with entrieslt MAC address portgt
MAC address identifies host network interface card (NIC)
port output port number of bridge
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 99
Assume an Ethernet frame arrives on port x
Frame Forwarding
Bridge 2Port A Port C
Port x
Port B
Search if MAC address of destination is listed for ports A B or C in the
filtering database
Flood the frame ie send the frame on all ports except port x if portstates allow it
FoundNotfound
Forward frame on corresponding port if different from the port on which the frame arrived and the port state allows it
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 100
Forwarding conditions
Forward the frame if and only if The receiving port is in a forwarding state The transmitting port is in a forwarding state Either the filtering database indicates the port
number for the destination MAC address or no such entry is present (in which case all ports are eligible transmission ports)
Do not transmit on port on which frame was received
The maximum service data unit size supported by the LAN to which the transmitting port is connected is not exceeded (eg 1500 bytes for Ethernet)
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 101
In principle the filtering database could be set statically (=static routing)
In the 8021 bridge the process is made automatic with a simple heuristic
The source address field of a frame that arrives on a port is used by the bridge to update its filtering database which indicates the port through which each host is reachable
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Hub
host n
Bridge 2
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 102
Algorithm For each frame received the bridge stores
the source address field in the received frame header into the filtering database together with the port on which the frame was received
All entries are deleted after some time (default is 300 seconds)
Address Learning
Bridge 2Port A Port C
Port x
Port B
host n
HUB LAN3
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 103
Example
Bridge 1
A CB D E F
Bridge 2
HUB LAN1 HUB LAN2 HUB LAN3
Port 2Port 1 Port 2Port 1
bullConsider the following packets ltSrc=A Dest=Fgt ltSrc=C Dest=Agt ltSrc=E Dest=Cgt
bullWhat have the bridges learned
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 104
Forwarding frames and learning
Frame reception
Frame transmission
Filtering database
Port state information
Port state information
Frame forwarding
Learning process
Learning process writes Filtering database
Frame forwarding reads Filtering database
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 105
Consider the two LANs that are connected by two bridges
Assume host n is transmitting a frame F with unknown destination
What is happening Bridges A and B flood the frame
to LAN 2 Bridge B sees F on LAN 2 (with
unknown destination) and copies the frame back to LAN 1
Bridge A does the same The copying continuesWherersquos the problem Whatrsquos
the solution
Danger of Loops
Bridge BBridge A
host nF
HUB LAN2
HUB LAN1
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 106
IEEE 8021 has an algorithm that builds and maintains a spanning tree in a dynamic environment
Bridges exchange messages to configure the bridge (Configuration Bridge Protocol Data Unit Configuration BPDUs) to build the tree
Spanning Trees
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 107
Concept - Bridge ID
Each bridge has a unique identifier (8 bytes)Bridge ID = ltpriority level + MAC addressgtPriority level = 2 bytes Note that a bridge has several MAC addresses
(one for each port) but only one ID using the MAC address of the lowest numbered bridge port (port 1)
Each port within a bridge has a unique identifier (port ID)
5124681f34 001235
fe64961213
3 12
Priority 0x1241
Bridge
Example above Bridge ID = 1241fe64961213
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 108
Concept - Root bridge of a network Root Bridge The bridge with the lowest
identifier is the root of the spanning tree
Bridge 3 with ID 0134121561987
Bridge 1 with ID= 4121121561987
Bridge 2 with ID= 6455421561987
Root bridge is bridge 3since it has the smallest ID
2 1
LAN A
LAN B
1
1
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 109
Concept - For each bridge Root Port Each bridge has a root port which
identifies the next hop from a bridge to the root Root Path Cost For each bridge the cost of the
min-cost path to the root Example on previous slide What is the root port and
root path cost of bridge 1 The root port is port 2 since it leads to the root bridge
(bridge 3) The root path cost is 1 since bridge 1 is one hop away
from the root bridge (Ie bridge 3) Note We assume that ldquocostrdquo of a path is the number of
ldquohopsrdquo
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 110
Concept - For each LAN Designated Bridge Designated Port Single
bridge on a LAN that provides the minimal cost path to the root for this LAN and the port on this minimal cost path if two bridges have the same cost select the
one with highest priority (lower bridge ID) if the min-cost bridge has two or more ports
on the LAN select the port with the lowest identifier
Example for LAN A the designated bridge is bridge 3 since it is the root bridge itself port 1 is the designated port for LAN B the designated bridge is bridge 1 since this is closer to the root bridge than bridge 2 The designated port is port 1
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 111
Concept - Designated bridgeport Even though each LAN is the entity that has a
designated bridgedesignated port it is each bridge that determines whether or not it is the designated bridge for the LAN on each of its ports
Example Bridge 1 in the example determines whether it is the designated bridge for LAN A (to which its port 2 is connected) and for LAN B (to which its port 1 is connected) Answer in this case is that bridge 1 is the designated
bridge for LAN B but it is not the designated bridge for LAN A
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 112
Steps of Spanning Tree Algorithm
1 Determine the root bridge of the whole network
2 For all other bridges determine root ports3 For all bridges determine which of the bridge
ports are designated ports for their corresponding LANs
The spanning tree consists of all the root ports and the designated ports
These ports are all set to the ldquoforwarding staterdquo while all other ports are in a ldquoblocked staterdquo
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 113
What we just did
We just determined the spanning tree for a network of LANs and bridges in a ldquocentralized mannerrdquo We knew the bridge IDs of all the bridges and the port IDs of
all the ports in all the bridges We determined the root bridge (the bridge with the smallest
ID) For each bridge we determined the shortest path to the root by
counting hops and thus identified the root port For each bridge we determined which of its ports are
designated ports for each of its LANs
However the network of bridges determines the spanning tree in a ldquodistributed mannerrdquo - each with limited knowledge This is done using messages called BPDUs
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 114
How do the bridges determine the spanning tree With the help of the BPDUs bridges can Elect a single bridge as the root bridge Each bridge can determine
a root port the port that gives the best path to the root
And the corresponding root path cost
Each bridge determines whether it is a designated bridge for the LANs connected to each of its ports The designated bridge will forward packets towards the root bridge
Select ports to be included in the spanning tree Root ports and designated ports
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 115
Short form notation for BPDUs Each bridge sends out BPDUs that
contain the following information
root bridge (what the sender thinks it is) root path cost for sending bridge
Identifies sending bridge
Identifies port on which this BPDU is sent
root IDroot ID costcost bridge IDport IDbridge IDport ID
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 116
Ordering of Messages We can order BPDU messages with the
following ordering relation ldquo lt
If (R1 lt R2)M1 lt M2
elseif ((R1 == R2) and (C1 lt C2)) M1 lt M2
elseif ((R1 == R2) and (C1 == C2) and (B1 lt B2))M1 lt M2
ID R1ID R1 C1C1 ID B1 ID B1 ID R2ID R2 C2 C2 ID B2ID B2ltM1 M2
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 117
Initially all bridges assume they are the root bridge Each bridge B sends BPDUs of this form on its LANs
Each bridge looks at the BPDUs received on all its ports and its own transmitted BPDUs
Root bridge is the smallest received root ID that has been received so far (Whenever a smaller ID arrives the root is updated)
Determine the Root Bridge
BB 00 BB
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 118
At this time A bridge B has a belief of who the root is say R
Bridge B determines the Root Path Cost (Cost) as follows
bull If B = R Cost = 0bull If B R Cost = Smallest Cost in any of BPDUs that were
received from R + 1
Brsquos root port is the port from which B received the lowest cost path to R
Knowing R and Cost B can generate its BPDU (but will not necessarily send it out)
Calculate the Root Path CostDetermine the Root Port
RR CostCost BB
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 119
At this time B has generated its BPDU
B will send this BPDU on one of its ports say port x only if its BPDU is lower (via relation ldquoltldquo) than any BPDU that B received from port x
In this case B also assumes that it is the designated bridge for the LAN to which the port connects
Determine if the bridge is the designated bridge for any of the LANs connected to its ports
RR CostCost BB
Bridge BPort A Port C
Port x
Port B
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 120
Selecting the Ports for the Spanning Tree At this time Bridge B has calculated the root
bridge for the network its root port root path cost and whether it is the designated bridge for each of its LANs
Now B can decide which ports are in the spanning tree
bull Brsquos root port is part of the spanning treebull All ports for which B is the designated bridge are part of
the spanning tree
Brsquos ports that are in the spanning tree will forward packets (=forwarding state)
Brsquos ports that are not in the spanning tree will block packets (=blocking state)
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 121
Adapting to Changes
Bridges continually exchange BPDUrsquos according to the rules we just discussed
This allows the bridges to adapt to changes to the topology
Whenever a BPDU arrives on a port say port x B bridge determines
bull Can B become the designated bridge for the LAN that port x is attached to
bull Can port x become the root port
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 122
Example 1
Bridge 18Port 1
Port 2
Port 4
Port 3
Bridge 51
Bridge 47
Bridge 27
Bridge 81
129351
12854781081
153127
bull Assume a Bridge with ID 18 has received the following as the lowest messages on its 4 ports
bull What is the root bridge
bull What is the Root Path Cost
bullWhat is the root port
bull What is 18rsquos configuration BPDU
bullFor which LAN (port) if any is B the designated bridge
Root is 12
85 +1 = 86
Port 2
128618
For Ports 13 4
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 123
Example 2
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411912581081
bull Assume a Bridge with ID 92 is receiving the following as the lowest messages on its five ports
bull What is the root bridge
bull What is the Root Path Cost
bull What is the root port
bull What is 92rsquos configuration BPDU
bull For which LAN (port) if any is Bridge 92 the designated bridge
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 124
Network Example (Practice) The attached network
shows 5 LANs that are interconnected by 5 bridges
The IDrsquos of the bridges are 12345 and the port IDrsquos are as indicated in the figure
The bridges run the spanning tree algorithm
Assume that the root cost path is the number of hops
Assume an initial state Show which messages are
exchanged until the tree is built
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 125
Network Example (Practice Final Answer) R Root ports D Designated
ports
Show all the BPDUs
Bridge 2
Bridge 5
Bridge 4 Bridge 3
Bridge 1
DD
R
R
D
D
R
R
HUB LAN2
HUB LAN5
HUB LAN1
HUB LAN3HUB LAN4
Port 1a
Port 1b
Port 3a
Port 3b
Port 4a
Port 4b
Port 5a
Port 5b
Port 2a
Port 2c
Port 2b
D
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 126
Failures
Root bridge periodically transmits configuration messages with message age 0
Bridges receiving these messages transmit them on the their designated ports
If the root or any bridge on the spanning tree fails then the configuration messages will time out
At that point the bridge will discard the configuration message and recalculate the root root path cost and root port
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 127
ExampleBridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
41121114112315
411392411392
411392
The new root port is 3
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
411390
4112111
411492
411392411392
4114924112315
The new root port is 5
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root
Week 1 128
Example
Bridge 92
Port 1
Port 2 Port 4
Port 5
Port 3
92092
4112111
92092
9209292092
920924112315
The bridge 92 will assume itself to be the root and will transmit 92092 on all five ports until it receives fresh configuration messages from any of its roots regarding a better root