Switching/L2 Basics
Session code: PX-13
Layer 2 Switching
Switching breaks up large collision domains
into smaller ones
Collision domain is a network segment with
two or more devices sharing the same
bandwidth.
A hub network is a typical example of this
type of technology
Each port on a switch is actually its own
collision domain, you can make a much better
Ethernet LAN network just by replacing your
hubs with switches
Switching Services
Unlike bridges that use software to create and
manage a filter table, switches use Application
Specific Integrated Circuits (ASICs)
Layer 2 switches and bridges are faster than
routers because they dont take up time looking
at the Network layer header information.
They look at the frames hardware addresses
before deciding to either forward the frame or
drop it.
layer 2 switching so efficient is that no
modification to the data packet takes place
How Switches and Bridges
Learn Addresses
Bridges and switches learn in the following ways:
Reading the source MAC address of each
received frame or datagram
Recording the port on which the MAC address
was received.
In this way, the bridge or switch learns which
addresses belong to the devices connected to
each port.
Ethernet Access with Hubs
Ethernet Access with Switches
Ethernet Switches and
Bridges
Address learning
Forward/filter decision
Loop avoidance
Switch Features
There are three conditions in which a switch will
flood a frame out on all ports except to the port
on which the frame came in, as follows:
Unknown unicast address
Broadcast frame
Multicast frame
MAC Address Table
Initial MAC address table is empty.
Learning Addresses
Station A sends a frame to station C.
Switch caches the MAC address of station A to port E0 by
learning the source address of data frames.
The frame from station A to station C is flooded out to all
ports except port E0 (unknown unicasts are flooded).
Learning Addresses (Cont.)
Station D sends a frame to station C.
Switch caches the MAC address of station D to port E3 by
learning the source address of data frames.
The frame from station D to station C is flooded out to all ports
except port E3 (unknown unicasts are flooded).
Filtering Frames
Station A sends a frame to station C.
Destination is known; frame is not flooded.
Broadcast and Multicast
Frames
Station D sends a broadcast or multicast frame.
Broadcast and multicast frames are flooded to all ports
other than the originating port.
Forward/Filter Decision
When a frame arrives at a switch interface, the destination
hardware address is compared to the forward/ filter MAC
database.
If the destination hardware address is known and listed in
the database, the frame is sent out only the correct exit
interface
If the destination hardware address is not listed in the MAC
database, then the frame is flooded out all active interfaces
except the interface the frame was received on.
If a host or server sends a broadcast on the LAN, the switch
will flood the frame out all active ports except the source
port.
Learning Mac Address
Learning Mac Address
Learning Mac Address
Learning Mac Address
Learning Mac Address
Learning Mac Address
Learning Mac Address
Forward/Filter PC3 to PC1
Forward/Filter PC3 to PC2
Loop Avoidance
Redundant
links
between switches are a
good idea because they
help prevent complete
network failures in the
event one link stops
working
However, they often
cause more problems
because frames can be
flooded
down
all
redundant
links
simultaneously
This creates network
loops
Network Broadcast Loops
A manufacturing floor PC
sent a network broadcast to
request a boot loader
The broadcast was first
received by switch sw1 on
port 2/1
The topology is redundantly
connected; therefore, switch
sw2 receives the broadcast
frame as well on port 2/1
Switch sw2 is also receiving
a copy of the broadcast
frame forwarded to the LAN
segment from port 2/2 of
switch sw1.
In a small fraction of the
time, we have four packets.
The
problem
grows
exponentially
until
the
network
bandwidth
is
Multiple Frame Copies
Spanning Tree Protocol
Overview
Redundancy in a network is extremely important
because redundancy allows networks to be fault
tolerant.
Redundant topologies based on switches and
bridges are subject to broadcast storms, multiple
frame transmissions, and MAC address database
instability.
Therefore network redundancy requires careful
planning and monitoring to function properly.
The Spanning-Tree Protocol is used in switched
Spanning-Tree Protocol
Provides a loop-free redundant network topology by
placing certain ports in the blocking state.
Spanning Tree Protocol
Spanning Tree Protocol resides in Data link Layer
Ethernet bridges and switches can implement the IEEE 802.1D
Spanning-Tree Protocol and use the spanning-tree algorithm to
construct a loop free network.
Spanning-Tree Port States
Spanning-tree transits each port through several different
states:
Disabled
Selecting the Root Bridge
The first decision that all switches in the network make, is to
identify the root bridge.
When a switch is turned on, the spanning-tree algorithm is used
to identify the root bridge. BPDUs are sent out with the Bridge ID
(BID).
The BID consists of a bridge priority that defaults to 32768 and
the switch base MAC address.
When a switch first starts up, it assumes it is the root switch and
sends BPDUs. These BPDUs contain BID.
All bridges see these and decide that the bridge with the smallest
BID value will be the root bridge.
A network administrator may want to influence the decision by
setting the switch priority to a smaller value than the default.
Spanning Tree Protocol
Terms
BPDU Bridge Protocol Data Unit (BPDU) - All the switches exchange information to use
in the selection of the root switch
Bridge ID - The bridge ID is how STP keeps track of all the switches in the network. It is
determined by a combination of the bridge priority (32,768 by default on all Cisco switches)
and the base MAC address.
Root Bridge -The bridge with the lowest bridge ID becomes the root bridge in the network.
Nonroot bridge - These are all bridges that are not the root bridge.
Root port - The root port is always the link directly connected to the root bridge or the
shortest path to the root bridge. If more than one link connects to the root bridge, then a
port cost is determined by checking the bandwidth of each link.
Designated port - A designated port is one that has been determined as having the best
(lowest) cost. A designated port will be marked as a forwarding port
Nondesignated Port - A nondesignated port is one with a higher cost than the designated
port. Nondesignated ports are put in blocking mode
Forwarding Port - A forwarding port forwards frames
Blocked Port - A blocked port is the port that will not forward frames, in order to prevent
Spanning-Tree Protocol
Root Bridge Selection
Bpdu = Bridge Protocol Data Unit
(default = sent every two seconds)
Root bridge = Bridge with the lowest bridge ID
Bridge ID =
In the example, which switch has the lowest bridge ID?
Spanning-Tree Operation
One root bridge per network
One root port per nonroot bridge
One designated port per segment
Nondesignated ports are unused
Selecting the Root Port
The STP cost is an accumulated total path cost based on the
rated bandwidth of each of the links
This information is then used internally to select the root port
for that device
Spanning-Tree Operation
One root bridge per network
One root port per nonroot bridge
One designated port per segment
Nondesignated ports are unused
19
100
Switching Methods
1. Cut-Through (Fast Forward)
The frame is forwarded through the switch before the entire frame
is received. At a minimum the frame destination address must be
read before the frame can be forwarded. This mode decreases the
latency of the transmission, but also reduces error detection.
2. Fragment-Free (Modified Cut-Through)
Fragment-free switching filters out collision fragments before
forwarding begins. Collision fragments are the majority of packet
errors. In Fragment-Free mode, the switch checks the first 64
bytes of a frame.
3. Store-and-Forward
The entire frame is received before any forwarding takes place.
Filters are applied before the frame is forwarded. Most reliable
and also most latency especially when frames are large.
Switching Methods
Thank You !!!