Transcript Switching
Layer 2 functionality –
bridging and switching
BSAD 141
Dave Novak
Sources: Network+ Guide to Networks,
Dean 2013
Overview
Layer 2 functionality
Error detection
Bridges
Broadcast and collision domains
How bridges work
Types of bridges
Switches
Types of switches
Buffering
Layer 2 functionality
Layer 1 functionality simply addresses the
transmission of modulated signals over the
media
Layer 2 functionality begins to incorporate
aspects of network management
Recognition of frame formats
MAC addressing
Some error checking
Layer 2 functionality
Recall from Lecture 2 on the OSI model
NIC is both logical and physical boundary
between layers 1 and 2
• Converts bits to frames and vice versa
• Error detection in bit to frame conversion
Error detection in media access (NIC
converting bits to frames) defined at layer 2
Layer 2 Errors
Interference can cause:
Random data to appear
Transmitted data to be lost or to be
corrupted in some manner
Digital and analog transmission is
susceptible to interference
Bits may be altered, lost, or the sequence of
bits might be rearranged – this creates
errors in the message
Layer 2 Errors
There are three basic data link layer error
detection technologies
1) Parity bits and parity checking
2) Checksum
3) Cyclic redundancy check (CRC)
Parity bits and parity
checking
Most basic error check
Sending node adds a bit to each character
(typically 7 bits / character in RS-232)
• Two types of parity
• 1) Even
• 2) Odd
Parity bits and parity
checking
Example: Using EVEN parity – the sender
sets the parity bit to either 1 or 0 whichever
makes the total number of 1 bits (including
parity) even
If character is 0010101, the parity bit is set
to ____
Receiver checks the parity
Checksum
The sender treats data as sequence of
binary integers and computes the sum
Receiver checks the sum
Data in Binary
Checksum Value
0001
1
0101
5
0011
3
Total
9
Cyclic redundancy check
(CRC)
We’ll say this is the most complex layer 2
error checking technique
Software algorithm to determine whether or
not data were received correctly
Simple to implement, easy to analyze, and
effective in detecting common errors
Does not verify integrity of sender, just
correctness
• http://en.wikipedia.org/wiki/Cyclic_redundancy_ch
eck
Higher Layer Switches
We are discussing layer 2 functionality
using specific hardware examples
Distinctions between modern network
hardware blurring
Modern networking devices don’t work
neatly and exclusively at single layer of OSI
Higher layer switches also work at layers 3
(network) and 4 (transport) of OSI
• Perform advanced filtering, performance
analysis, and security
Bridging
Technique used to connect networks at
data link layer
Hubs connect networks at ______________
Adding another hub is analogous to adding
more ports to an existing hub or extending a
bus topology network
All packets forwarded to all devices on
network
No management capabilities
Bridging
A bridge is a physical device
Computer with two NICs
Special device with two ports
Bridging
Incorporates concept of basic management
via frame filtering
If LAN segment is congested
Break LAN into 2 segments and bridge them
together
Frame/Packet filtering
Layer 2 devices read MAC source and
destination address of all frames
Can’t go any higher in OSI
Can’t read or interpret data in payload
Bridge discards frame and does not forward if
receiver is located on same segment as sender
Bridge copies frame and forwards it to the
appropriate segment if receiver is on separate
segment
Bridges and concept of
collision domain
Collision Domain
Add hub to LAN
Add device to port on existing hub
Separate segments of a bridged LAN form
two separate collision domains
Improve performance by reducing collisions
Bridges and concept of
broadcast domain
Broadcast Domain
Unicast
Multicast
Bridges and concept of
broadcast domain
Standard way to locate deviceBroadcast message asking
for IP address
Bridges and concept of
broadcast domain
Bridges do NOT create separate
broadcast domains
Bridge relays broadcasts to both segments of
bridged LAN
Important conceptual idea: A shared
broadcast domain is needed for devices to
remain part of same LAN or subnet
Adaptive / Transparent
Bridging
Learn locations of computers on different
segments
Store information in a table that might contain:
MAC address, NetBIOS name, segment ID
Starts with no information in the table
Create table of devices on each segment
Adaptive / Transparent
Bridging
Bridge performs 2 calculations when frame
arrives
• 1) Examine source / destination MAC address and
add source address to list
• 2) Forward frame if needed
How a bridge works
How a bridge works
Bridges learn computer locations quickly
• Computers tend to be fairly active
• The longer the bridge is run without rebooting,
the more efficient the operation
• Permits simultaneous use of each segment
• Can optimize performance (parallelism)
How a bridge works
To improve performance computers that
communicate often should be located on
same segment
Why? (think about locality of reference…)
Spanning Tree Algorithm
(STA)
STAs are frame forwarding decision
algorithms
If a cycle of bridges/switches is present,
broadcast will cycle infinitely (infinite loop)
STA prevents infinite loops
• Protocol selects single forwarding path on LAN
• Detect circular patterns and modify way devices
work together
Routers DO NOT forward broadcasts
Discuss 3 bridging
functions
1) Local Bridge
2) Translation Bridge
3) Remote Bridge
Local Bridge
Standard device used to connect network
segments of the same type (use the same data link
protocols or LAN technology)
• For example, Ethernet
Very simple
Does not modify data in headers, just reads
the MAC address and either passes the
frame on or discards it
Translation Bridge
Device used to connect network segments
of different types (use different data link protocols or
LAN technology)
• For example, Ethernet to token ring
More complicated
Strips frame from packets received from one
type LAN segment and repackages them in
frame suitable for other LAN segment
• Recall frame formats are different depending on
the underlying data link protocols (LAN
technologies used)
Translation Bridge
Ethernet Frame
A
B
C
D
E
FDDI Frame
F
A = Preamble (7 B)
B = Start of Frame Delimiter (1 B)
C = Destination Address (6 B)
D = Source Address (6 B)
E = Ethertype / length (2 B)
F = Data and Pad (46 – 1500 B)
G = Frame Check (4 B)
G
A
B
C
D
E
F
G
H
I
A = Preamble (8 B)
B = Start Delimiter (1 B)
C = Frame Control (1 B)
D = Destination Address (6 B)
E = Source Address (6 B)
F = Data (variable)
G = Frame Check (4 B)
H = End Delimiter (4 b)
I = End of Frame Sequence (12 b)
Remote Bridge
Device used to connect network segments
at distant locations using some type of WAN
link
For example, connect two remote Ethernet
segments using a leased telephone line
Could function as either local or translation
bridge, but main purpose is to limit traffic on
WAN link
Switching
Data link functionality fundamental to LANs
A switch generally replaces a bridge in
modern switched Ethernet networking
Allow multiple users to exchange information
simultaneously without slowing each other
down
• Promotes parallelism
Switching
Allow different nodes to communicate
directly with each other
Physically resembles a hub
Important conceptual issue:
Hub simulates shared media with bus
topology functionality
Switch simulates a bridged LAN with one
computer per segment
Switching
Forward data out a single port
Recall how this is different from a hub
Physical star topology can support:
• Logical star
• Logical bus
• Logical ring
Functionally, these logical topologies are
quite different!
Switching
Switching
Functionally converts a shared network
medium to a dedicated network medium
Creates a separate collision domain for two
devices communicating along a dedicated
path
• Forward broadcasts to all ports
• Do NOT forward multicast or unicast to all ports
No device on the switched network receives
packets that are addressed to other devices
Legacy Ethernet (Hub
example)
Physical Star / Logical Bus
N1
N2
N3
Before switching, Ethernet supported only half
duplex transmission
Hub forwards electrical signals on all ports, so only
one node can use the media at a time – each node
communicates directly with all other nodes on
the network. The hub is just a conduit or connection
point that links the nodes together (functionally a bus).
Hub
N4
N5
N6
Node 4 sends a message destined for Node 3,
the hub forwards the packets out all ports, effectively
tying up the media and preventing simultaneous (full duplex) communication
Node 3 will receive the frames, read the MAC address and “accept” the message
All other nodes will also receive the frames, but will read the MAC address and discard
the message – as the MAC address is associated with Node 3
Switched Ethernet (Switch
example)
Physical Star / Logical Star
N1
N2
N3
With switching, Ethernet supports full duplex transmission
Each node communicates directly with the switch, as
opposed to directly with the other nodes on the LAN.
Information travels from node to switch and from switch
to node simultaneously.
N4
Node 4 sends a message destined for Node 3 to the
switch. At the same time, Node 2 can send message
destined for Node 3 to the switch. The switch will
only forward the message out the port connected directly to Node 3.
Node 3 could be communicating with other nodes at the same time
Switches provide a collision free environment.
Each node has a dedicated connection to itself
Switch
N5
N6
Simplified switch example
E3-21-OK-8P-00-0C
How it works
The switch contains a lookup
table that maps the MAC address
to a specific output port
MAC address
N1
N2
Port 2
Outgoing Port
E3-21-OK-8P-00-0C
Port 1
F4-34-IJ-8L-00-0C
Port 2
N3
Port 1
Ports 1, 2, 3
Switch
Ports 4, 5, 6
Port 4
The switch “knows” A6-43-IK-0P-00-12 (Node 4)
is attached to Port 4. If Node 4 is sending a
message to E3-21-OK-8P-00-0C (Node 1), the
switch knows the message must be sent out
Port 1
N4
A6-43-IK-0P-00-12
N5
N6
Switching
If a new node is added to a switch, how
does the switch add the new MAC address
to its lookup table?
Switching
Another advantage of switches is that each
device / node attached to a switch has
dedicated full bandwidth of the LAN
Example
Switching on Enterprise
networks
What are the implications associated
with replacing the backbone switch
with a backbone router with respect to
the broadcast domain?
How would you describe the backbone
design you see in this figure?
Switch functionality
1) Cut Through
2) Store and forward
Cut Through Switches
Forwards frame immediately by reading
MAC destination address in frame header
No additional processing (no error checking)
– forwards packets out appropriate
destination port w/o delay
Doesn’t wait for entire message stream to
arrive before forwarding
Relatively inexpensive
Store and Forward
Switches
Waits for entire message stream to arrive
before forwarding to destination
While in memory, switch performs basic layer 2
error checking on frames
Requires buffering to store frames
Can be shared memory buffer (shared by all ports on
switch)
Can be bus architecture memory (individual memory
buffers for each port)
Buffer
Say our bridge buffer holds six frames
Satellite or leased link
1.5 Mbps: outgoing
frames
3 frames are currently buffered
Buffer is full, additional frames
are dropped and must eventually
be resent
LAN link 100Mbps:
Incoming frames
Frames arrive, but
buffer is full
Summary
Layer 2 functionality
Error detection
Bridging
Broadcast and collision domains
How bridges work
Types of bridges
Switching
Types of switches
Buffering