bridges and switches
TRANSCRIPT
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 1/49
Bridges and Switches
Credits: Web resources of books on
Computer Networks by
Peterson & Davie, Forouzon andStallings
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 2/49
Bridges
• Link layer device
– stores and forwards Ethernet frames– examines frame header and selectively
forwards frames based on MAC destaddress
– when frame is to be forwarded onsegment, uses CSMA/CD to accesssegment
• transparent
– hosts are unaware of presence of bridges
• plug-and-play, self-learning (typically)
– bridges do not need to be configured
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 3/49
Bridges: traffic isolation
• Bridge installation breaks LAN into LAN segments
• bridges filter packets: – same-LAN-segment frames not usually
forwarded onto other LAN segments
– segments become separate collisiondomains
bridgecollisiondomain
collisiondomain
= hub
= host
LAN (IP network)
LAN segment LAN segment
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 4/49
Bridging Function
• A bridge has a bridge table
• entry in bridge table:
– (Node LAN Address, Bridge Interface,
Time Stamp)– stale entries in table dropped (TTL can be
60 min)
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 5/49
Filtering/Forwarding
When bridge receives a frame:
index bridge table using MAC dest address
if entry found for destinationthen{
if dest on segment from which frame arrivedthen drop the frame
else forward the frame on interfaceindicated
}
else floodforward on all but the interface on which the frame arrived
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 6/49
Bridge Table ConfigurationTypes
• Can be configured
–Manually (termed fixed bridging /routing) – has to be changed if
necessary by the administrator
–Self Learning
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 7/49
Fixed Routing
• Complex large LANs need alternative routes– Load balancing– Fault tolerance
• Bridge must decide whether to forward
frame• Bridge must decide which LAN to forward
frame on• Routing selected for each source-destination
pair of LANs– Done in configuration– Usually least hop route– Only changed when topology changes
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 8/49
Spanning Tree
• Bridge automatically developsbridge table
• Automatically updates in responseto changes
–Frame forwarding
–Address learning
–Loop resolution
Reference: Stallings
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 9/49
Frame forwarding
• Maintain forwarding database for each port– List station addresses reached through each port
• For a frame arriving on port X:– Search forwarding database to see if MAC address is
listed for any port except X– If address not found, forward to all ports except X
– If address listed for port Y, check port Y for blockingor forwarding state
• Blocking prevents port from receiving or transmitting
– If not blocked, transmit frame through port Y
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 10/49
Address Learning
• When frame arrives at port X, it has comeform the LAN attached to port X
• Use the source address to update forwarding
database for port X to include that address
• Timer on each entry in database (resetwhenever frame received)
• Each time frame arrives, source address
checked against forwarding database
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 11/49
Bridge Address Learningexample
Suppose C sends frame to D and D replies backwith frame to C.
Bridge receives frame from from C notes in bridge table that C is on interface 1
because D is not in table, bridge sends frame intointerfaces 2 and 3
frame received by D
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 12/49
Bridge Learning: example
D generates frame for C, sends
bridge receives frame notes in bridge table that D is on interface 2
bridge knows C is on interface 1, so selectively forwardsframe to interface 1
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 13/49
Flooding Can Lead to Loops• Switches sometimes need to broadcast frames
– Upon receiving a frame with an unfamiliardestination
– Upon receiving a frame sent to the broadcastaddress
• Broadcasting is implemented by flooding– Transmitting frame out every interface– … except the one where the frame arrived
• Flooding can lead to forwarding loops– E.g., if the network contains a cycle of switches
– Either accidentally, or by design for higher reliability
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 14/49
Solution: Spanning Trees• Ensure the topology has no loops
– Avoid using some of the links when flooding– … to avoid forming a loop
• Spanning tree– Sub-graph that covers all vertices but contains no
cycles
– Links not in the spanning tree do not forward frames
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 15/49
Constructing a Spanning Tree
• Need a distributed algorithm– Switches cooperate to build the spanning tree– … and adapt automatically when failures occur
• Key ingredients of the algorithm
– Switches need to elect a “root” • The switch with the smallest identifier
– Each switch identifies if its interfaceis on the shortest path from the root• If not it excludes from the tree
– Messages (Y, d, X)• From node X• Claiming Y is the root• And the distance is d
root
One hop
Three hops
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 16/49
Steps in Spanning TreeAlgorithm
• Initially, each switch thinks it is the root– Switch sends a message out every interface– … identifying itself as the root with distance 0 – Example: switch X announces (X, 0, X)
• Switches update their view of the root– Upon receiving a message, check the root id– If the new id is smaller, start viewing that switch as
root
• Switches compute their distance from the root
– Add 1 to the distance received from a neighbor– Identify interfaces not on a shortest path to the
root– … and exclude them from the spanning tree
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 17/49
Example From Switch #4’s Viewpoint
• Switch #4 thinks it is the root– Sends (4, 0, 4) message to 2
and 7
• Then, switch #4 hears from #2– Receives (2, 0, 2) message from
2
– … and thinks that #2 is the root – And realizes it is just one hop
away
• Then, switch #4 hears from #7– Receives (2, 1, 7) from 7– And realizes this is a longer path– So, prefers its own one-hop path– And removes 4-7 link from the
tree
1
2
3
4
5
67
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 18/49
Example From Switch #4’s Viewpoint
• Switch #2 hears aboutswitch #1– Switch 2 hears (1, 1, 3)
from 3– Switch 2 starts treating 1
as root– And sends (1, 2, 2) to
neighbors
• Switch #4 hears from
switch #2– Switch 4 starts treating 1as root
– And sends (1, 3, 4) toneighbors
1
2
3
4
5
67
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 19/49
Robust Spanning TreeAlgorithm
• Algorithm must react to failures– Failure of the root node
• Need to elect a new root, with the next lowest identifier
– Failure of other switches and links• Need to recompute the spanning tree
• Root switch continues sending messages– Periodically reannouncing itself as the root (1, 0, 1)– Other switches continue forwarding messages
• Detecting failures through timeout (soft state!)
– Switch waits to hear from others– Eventually times out and claims to be the root
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 20/49
Another Example:
A
C
E
D
B
K
F
H
J
G
I
B3
B7
B4
B2
B5
B1
B6
A
C
E
D
B
K
F
H
J
G
I
B5
B2
B3
B7
B4
B1
B6
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 21/49
Example: working
–B1 is the root bridge
–B3 and B5 are both connected to LANA, but B5 is the designated port since
it's closer to root–B5 and B7 are both connected to LAN
B, but B5 is the designated port dueto smaller ID (equal distance).
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 22/49
BRIDGE FEATURES ANDROUTERS
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 23/49
Some bridge features
• Isolates collision domains resulting in highertotal max throughput
• Can connect different Ethernet types
• Transparent (“plug-and-play”): no
configuration necessary
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 24/49
Bridges vs. Routers
• both store-and-forward devices
– routers: network layer devices (examine network layerheaders)
– bridges are link layer devices
• routers maintain routing tables, implement
routing algorithms
• bridges maintain bridge tables, implement
filtering, learning and spanning tree algorithms
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 25/49
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 26/49
Routers vs. Bridges
Routers + and -
+ arbitrary topologies can be supported, cycling
is limited by TTL counters (and good routing
protocols)+ provide protection against broadcast storms
- require IP address configuration (not plug andplay)
- require higher packet processing
• bridges do well in small (few hundred hosts)while routers used in large networks (thousandsof hosts)
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 27/49
Ethernet Switches
• Essentially a multi-interfacebridge
• layer 2 (frame) forwarding,filtering using LAN addresses
• Switching: A-to-A’ and B-to-B’ simultaneously, no collisions
• large number of interfaces
• often: individual hosts, star-connected into switch
– Ethernet, but no collisions!
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 28/49
Ethernet Switch Types
• Store and Forward Switches:
receives, buffers and sends
• cut-through switching: frameforwarded from input to outputport without awaiting for assemblyof entire frame (as soon as it sees
destination address in header)– slight reduction in latency
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 29/49
OVERALL PICTURE
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 30/49
Message, Segment, Packet, and Frame
HTTP
TCP
IP
Ethernetinterface
HTTP
TCP
IP
Ethernetinterface
IP IP
Ethernetinterface
Ethernetinterface
SONETinterface
SONETinterface
host host
router router
HTTP message
TCP segment
IP packet IP packetIP packet
Ethernet frame Ethernet frameSONET frame
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 31/49
Shuttling Data at Different Layers
• Different devices switch different things– Network layer: packets (routers)– Link layer: frames (bridges and switches)– Physical layer: electrical signals (repeaters
and hubs)
Application gateway
Transport gateway
Router
Bridge, switch
Repeater, hub
Frame
header
Packet
header
TCP
header
User
data
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 32/49
LAYER 2 AND 3 DEVICES
Add ons: from William Stallings
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 33/49
Layer 2 and Layer 3 Switches
• Now many types of devices forinterconnecting LANs
• Beyond bridges and routers
• Layer 2 switches
• Layer 3 switches
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 34/49
Physical Layer: Repeaters• Distance limitation in local-area
networks– Electrical signal becomes weaker as it travels– Imposes a limit on the length of a LAN
• Repeaters join LANs together– Analog electronic device– Continuously monitors electrical signals on
each LAN– Transmits a reconstructed copy
Repeater
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 35/49
Hubs
• Active central element of star layout• Joins multiple input lines electrically• Each station connected to hub by two lines
– Transmit and receive
• Hub acts as a repeater
• When single station transmits, hub repeats signal onoutgoing line to each station• Line consists of two unshielded twisted pairs• Limited to about 100 m
– High data rate and poor transmission qualities of UTP
• Optical fiber may be used– Max about 500 m
• Physically star, logically bus• Transmission from any station received by all other stations• If two stations transmit at the same time, collision
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 36/49
Hub Layouts
• Multiple levels of hubs cascaded
• Each hub may have a mixture of stations andother hubs attached to from below
• Fits well with building wiring practices
– Wiring closet on each floor
– Hub can be placed in each one
– Each hub services stations on its floor
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 37/49
Two Level Star Topology
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 38/49
Buses and Hubs
• Bus configuration– All stations share capacity of bus (e.g.
10Mbps)
– Only one station transmitting at a time
• Hub uses star wiring to attach stations tohub– Transmission from any station received by hub
and retransmitted on all outgoing lines
– Only one station can transmit at a time– Total capacity of LAN is 10 Mbps
• Improve performance with layer 2 switch
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 39/49
Shared Medium Bus and Hub
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 40/49
Shared Medium Hub andLayer 2 Switch
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 41/49
Layer 2 Switches
• Central hub acts as switch
• Incoming frame from particularstation switched to appropriateoutput line
• Unused lines can switch other traffic
• More than one station transmitting ata time
• Multiplying capacity of LAN
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 42/49
Types of Layer 2 Switch
• Store-and-forward switch– Accepts frame on input line
– Buffers it briefly,
– Then routes it to appropriate output line
– Delay between sender and receiver– Boosts integrity of network
• Cut-through switch– Takes advantage of destination address appearing at
beginning of frame
– Switch begins repeating frame onto output line as soonas it recognizes destination address
– Highest possible throughput
– Risk of propagating bad frames
• Switch unable to check CRC prior to retransmission
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 43/49
Layer 2 Switch v Bridge
• Layer 2 switch can be viewed as full-duplex hub• Can incorporate logic to function as multiport bridge• Bridge frame handling done in software• Switch performs address recognition and frame
forwarding in hardware
• Bridge only analyzes and forwards one frame at atime
• Switch has multiple parallel data paths– Can handle multiple frames at a time
• Bridge uses forward operation
• Switch can have cut-through operation• Bridge suffered commercially
– New installations typically include layer 2 switches withbridge functionality rather than bridges
bl h
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 44/49
Problems with Layer 2Switches (1)
• As number of devices in building grows, layer 2switches reveal some inadequacies
• Broadcast overload
• Lack of multiple links
• Set of devices and LANs connected by layer 2switches have flat address space– Allusers share common MAC broadcast address
– If any device issues broadcast frame, that frame isdelivered to all devices attached to network connected
by layer 2 switches and/or bridges– In large network, broadcast frames can create big
overhead
– Malfunctioning device can create broadcast storm
• Numerous broadcast frames clog network
bl h 2
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 45/49
Problems with Layer 2Switches (2)
• Current standards for bridge protocols dictate noclosed loops– Only one path between any two devices
– Impossible in standards-based implementation to providemultiple paths through multiple switches between devices
• Limits both performance and reliability.
• Solution: break up network into subnetworksconnected by routers
• MAC broadcast frame limited to devices and switchescontained in single subnetwork
• IP-based routers employ sophisticated routingalgorithms– Allow use of multiple paths between subnetworks going
through different routers
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 46/49
Problems with Routers
• Routers do all IP-level processing insoftware– High-speed LANs and high-performance
layer 2 switches pump millions of packetsper second
– Software-based router only able to handlewell under a million packets per second
• Solution: layer 3 switches– Implementpacket-forwarding logic of router
in hardware• Two categories
– Packet by packet– Flow based
P k b P k
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 47/49
Packet by Packet orFlow Based
• Operates insame way as traditional router
• Order of magnitude increase in performancecompared to software-based router
• Flow-based switch tries to enhanceperformance by identifying flows of IPpackets– Same source and destination
– Done by observing ongoing traffic or using aspecial flow label in packet header (IPv6)
– Once flow is identified, predefined route can beestablished
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 48/49
Typical Large LAN Organization
• Thousands to tens of thousands of devices• Desktop systems links 10 Mbps to 100 Mbps
– Into layer 2 switch
• Wireless LAN connectivity available for mobile users• Layer 3 switches at local network's core
– Form local backbone– Interconnected at 1 Gbps– Connect to layer 2 switches at 100 Mbps to 1 Gbps
• Servers connect directly to layer 2 or layer 3 switchesat 1 Gbps
• Lower-cost software-based router provides WANconnection• Circles in diagram identify separate LAN subnetworks• MAC broadcast frame limited to own subnetwork
8/3/2019 Bridges and Switches
http://slidepdf.com/reader/full/bridges-and-switches 49/49
TypicalLarge
LANOrganizat
ion
Diagram