Switching PDF
Switching PDF
11 – Aaron Balchunas 1
- Switching Architectures -
Network Traffic Models
Traffic flow is an important consideration when designing scalable, efficient
networks. Fundamentally, this involves understanding two things:
• Where do resources reside?
• Where do the users reside that access those resources?
Legacy networks adhered to the 80/20 design, which dictated that:
• 80 percent of traffic should remain on the local network.
• 20 percent of traffic should be routed to a remote network.
To accommodate this design practice, resources were placed as close as
possible to the users that required them. This allowed the majority of traffic
to be switched, instead of routed, which reduced latency in legacy networks.
The 80/20 design allowed VLANs to be trunked across the entire campus
network, a concept known as end-to-end VLANs:
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switching Architectures v1.11 – Aaron Balchunas 2
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switching Architectures v1.11 – Aaron Balchunas 3
The access layer is where users and hosts connect into the network.
Switches at the access layer typically have the following characteristics:
• High port density
• Low cost per port
• Scalable, redundant uplinks to higher layers
• Host-level functions such as VLANs, traffic filtering, and QoS
In an 80/20 design, resources are placed as close as possible to the users that
require them. Thus, most traffic will never need to leave the access layer.
In a 20/80 design, traffic must be forwarded through higher layers to reach
centralized resources.
(Reference: CCNP Switch 642-813 Official Certification Guide by David Hucaby. Cisco Press)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switching Architectures v1.11 – Aaron Balchunas 4
(Reference: CCNP Switch 642-813 Official Certification Guide by David Hucaby. Cisco Press)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switching Architectures v1.11 – Aaron Balchunas 5
The core layer is responsible for connecting all distribution layer switches.
The core is often referred to as the network backbone, as it forwards traffic
from to every end of the network.
Switches at the core layer typically have the following characteristics:
• High-throughput Layer-3 or multilayer forwarding
• Absence of traffic filtering, to limit latency
• Scalable, redundant links to the distribution layer and other core
switches
• Advanced QoS functions
Proper core layer design is focused on speed and efficiency. In a 20/80
design, most traffic will traverse the core layer. Thus, core switches are often
the highest-capacity switches in the campus environment.
Smaller campus environments may not require a clearly defined core layer
separated from the distribution layer. Often, the functions of the core and
distribution layers are combined into a single layer. This is referred to as a
collapsed core design.
(Reference: CCNP Switch 642-813 Official Certification Guide by David Hucaby. Cisco Press)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switching Architectures v1.11 – Aaron Balchunas 6
- Switching Tables -
Layer-2 Forwarding Overview
Layer-2 devices build hardware address tables, which at a minimum
contain the following:
• Hardware addresses for hosts (such as Ethernet MAC addresses)
• The port each hardware address is associated with
Using this information, Layer-2 devices will make intelligent forwarding
decisions based on the frame (or data-link) header. A frame can then be
forwarded out only the appropriate destination port, instead of all ports.
Layer-2 forwarding was originally referred to as bridging. Bridging is a
largely deprecated term (mostly for marketing purposes), and Layer-2
forwarding is now commonly referred to as switching.
Switching Queues
Layer-2 switches utilize queues to store incoming and outgoing frames.
Consider the following diagram:
1. The switch receives a frame on Port 1, from HostA destined for HostB.
2. The frame is placed in Port 1’s ingress queue.
3. The switch performs a lookup on the destination hardware address -
HostB in this example.
4. The switch determines that the appropriate destination port for HostB is
Port 2.
5. The frame is placed in Port 2’s egress queue.
If the switch had no knowledge of HostB’s hardware address, the frame
would be placed in the egress queue of all ports except for the originating
port, and thus flooded to the entire network.
A port can contain multiple ingress or egress queues. This allows critical
traffic to be prioritized over less important traffic.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switching Tables v1.11 – Aaron Balchunas 2
A single switch port can learn many addresses. In the above output,
GigabitEthernet1/1 has multiple MAC addresses associated with it. This
usually indicates this is an uplink to another switch.
To view the CAM table entries for a specific port or MAC address:
Switch# show mac address-table interface GigabitEthernet 1/5
vlan mac address type port
-------+---------------+---------+---------------------
9 d067.e50b.1975 dynamic GigabitEthernet1/5
The output of a command can be filtered using the pipe command. For
example, to search for any entry that contains 3a7d in the MAC address:
Switch# show mac address-table | include 3a7d
vlan mac address type port
-------+---------------+---------+---------------------
9 842b.2ba6.3a7d dynamic GigabitEthernet1/3
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switching Tables v1.11 – Aaron Balchunas 5
The CAM aging timer can be changed from its default of 300, though this is
needed only in rare circumstances:
Switch# config t
Switch(config)# mac address-table aging-time 360
Note: In Cisco IOS versions prior to 12.1, the syntax for all CAM table
commands contained an additional hyphen between mac and address:
Switch# show mac-address-table
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switching Tables v1.11 – Aaron Balchunas 6
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch Port Configuration v1.31 – Aaron Balchunas 1
The basic IOS interface is nearly identical between switches and routers, and
is covered in great detail in other guides on this site:
• Introduction to the Cisco IOS
• Advanced IOS Functions
This guide will focus on switch-specific IOS functions. For a more
comprehensive IOS review, consult the guides listed above.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch Port Configuration v1.31 – Aaron Balchunas 2
Note that most switches will number their modules and interfaces starting at
1, while most routers will number their modules/interfaces starting at 0.
The above command can be shortened, as long as the truncated command is
not ambiguous:
Switch(config)# interface fa 2/3
The above command selects interfaces gi2/3, gi2/5, gi2/7. Please note that
there is a space on either side of each comma.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch Port Configuration v1.31 – Aaron Balchunas 3
The above command selects interfaces gi3/10 through gi3/15. Please note
the space on either side of the dash.
Macros can be created for groups of interfaces that are configured often:
Switch(config)# define interface-range MACRONAME gi3/10 – 15
Switch(config)# interface range macro MACRONAME
Switch(config-if-range)#
Ethernet also has the ability to autonegotiate both the speed and duplex of
an interface. Autonegotiation will attempt to use the fastest speed available,
and will attempt to use full-duplex if both devices support it.
Only one command is required to force an interface to autonegotiate its
speed and duplex:
Switch(config)# interface gi3/10
Switch(config-if)# speed auto
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch Port Configuration v1.31 – Aaron Balchunas 7
However, if the error condition still exists, the interface will be placed back
into an errdisable state again. Thus, an interface should not be recovered
until the root cause is resolved.
Interfaces can also automatically recover from an error condition. First, the
errdisable conditions that should auto-recover must be individually or
collectively identified:
Switch(config)# errdisable recovery cause udld
Switch(config)# errdisable recovery cause all
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch Port Configuration v1.31 – Aaron Balchunas 9
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 1
VLAN Example
Consider the following example:
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 3
Advantages of VLANs
VLANs provide the several benefits:
• Broadcast Control – eliminates unnecessary broadcast traffic,
improving network performance and scalability.
• Security – logically separates users and departments, allowing
administrators to implement access-lists to control traffic between
VLANs.
• Flexibility – removes the physical boundaries of a network, allowing
a user or device to exist anywhere.
VLANs are very common in LAN and campus networks. For example, user
networks are often separated from server networks using VLANs.
VLANs can span across WANs as well, though there are only limited
scenarios where this is necessary or recommended.
VLAN Membership
VLAN membership can be configured one of two ways:
• Statically
• Dynamically
Statically assigning a VLAN involves manually assigning an individual or
group of ports to a VLAN. Any host connected to that port (or ports)
immediately becomes a member of that VLAN. This is transparent to the
host - it is unaware that it belongs to a VLAN.
VLANs can be assigned dynamically based on the MAC address of the
host. This allows a host to remain in the same VLAN, regardless of which
switch port it is connected to.
Dynamic VLAN assignment requires a separate database to maintain the
MAC-address-to-VLAN relationship. Cisco developed the VLAN
Membership Policy Server (VMPS) to provide this functionality.
In more sophisticated systems, a user’s network account can be used to
determine VLAN membership, instead of a host’s MAC address.
Static VLAN assignment is far more common than dynamic, and will be the
focus of this guide.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 4
Creating VLANs
By default, all interfaces belong to VLAN 1. To assign an interface to a
different VLAN, that VLAN must first be created:
Switch(config)# vlan 100
Switch(config-vlan)# name SERVERS
The first command creates VLAN 100, and enters VLAN configuration
mode. The second command assigns the name SERVERS to this VLAN.
Note that naming a VLAN is not required.
The standard range of VLAN numbers is 1 – 1005, with VLANs 1002-1005
reserved for legacy Token Ring and FDDI purposes.
A switch operating in VTP transparent mode can additionally use the
VLAN range of 1006 – 4094. These are known as extended-range VLANs.
VTP is covered in great detail later in this guide.
To remove an individual VLAN:
Switch(config)# no vlan 100
Note that no interfaces have been assigned to the newly created VLAN 100
yet.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 5
For switches running in VTP server or client mode, the list of VLANs are
stored in a database file named vlan.dat. The vlan.dat file is usually stored
in flash, though on some switch models it is stored in NVRAM. The VLAN
database will be maintained even if the switch is rebooted.
For switches running in VTP transparent mode, the list of VLANs is stored
in the startup-config file in NVRAM. VTP is covered extensively later in
this guide.
Regardless of VTP mode, the VLAN assignment for every switch interface
is stored in the switch’s startup-config.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 6
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 7
VLAN Frame-Tagging
When VLANs span multiple switches, a mechanism is required to identify
which VLAN a frame belongs to. This is accomplished through frame
tagging, which places a VLAN ID in each frame.
Tagging only occurs when a frame is sent out a trunk port. Traffic sent out
access ports is never tagged. Consider the following example:
SwitchA SwitchB
gi gi
/ 11
/ 21
/10 1/
12 /20 1/
22
gi1 gi1
gi 1
gi1
HostA HostB HostC HostD HostE HostF
VLAN 100 VLAN 100 VLAN 200 VLAN 100 VLAN 100 VLAN 200
IEEE 802.1Q
IEEE 802.1Q, otherwise referred to as dot1Q, is an industry-standard
frame-tagging protocol.
802.1Q is supported by nearly all switch manufacturers, including Cisco.
Because 802.1Q is an open standard, switches from different vendors can be
trunked together.
Recall that ISL encapsulates a frame with an additional header and trailer. In
contrast, 802.1Q embeds a 4-byte VLAN tag directly into the Layer-2 frame
header. Because the Layer-2 header is modified, 802.1Q must recalculate the
frame’s CRC value.
The VLAN tag includes a 12-bit VLAN ID. This tag increases the size of an
Ethernet frame, from its default of 1514 bytes to 1518 bytes. Nearly all
modern switches support the 802.1Q tag and the slight increase in frame
size.
802.1Q supports a maximum of 4096 VLANs on a trunk port.
For a switch that supports both ISL and 802.1Q, the tagging or
encapsulation protocol must be configured first:
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk encapsulation isl
Switch(config-if)# switchport mode trunk
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk encapsulation dot1q
Switch(config-if)# switchport mode trunk
Important note: Both sides of the trunk must be configured with the same
tagging protocol. Otherwise, a trunk connection will not form.
If the switch only supports 802.1Q, the switchport trunk encapsulation
command will not be available.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 10
The tagging protocol that is supported by both switches will be used. If the
switches support both ISL and 802.1Q, ISL will be the preferred protocol.
By default, all active VLANs are allowed to traverse a trunk link. While this
is convenient, a good security practice is to allow only necessary VLANs
over a trunk.
To explicitly allow a subset of VLANs on a trunk port:
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk allowed vlan 3,9,11-15
The above command will force the trunk link to only forward traffic from
VLANS 3, 9, and 11 – 15. To remove a VLAN from the allowed list:
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk allowed vlan remove 12
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 11
Native VLANs
Recall that a trunk port tags frames with a VLAN ID. But what happens if a
trunk port receives an untagged frame?
The native VLAN determines the VLAN that untagged traffic belongs to.
By default on all trunking ports, the native VLAN is VLAN 1. The native
VLAN can be changed on a per trunk port basis:
Switch(config)# interface gi2/24
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk native vlan 42
Only one native VLAN can be assigned to a trunk port. All untagged traffic
received on this port will become a member of the native VLAN.
Additionally, frames belonging to the native VLAN are not tagged when
being sent out a trunk port.
Native VLANS are only supported on 802.1Q trunk ports. ISL does not
support untagged frames, and will always tag frames from all VLANs.
The native VLAN must be configured identically on both sides of the
802.1Q trunk, otherwise the switches will not form a trunk connection.
The original intent of native VLANs was for legacy compatibility with hubs.
Consider the following deprecated example:
DTP has two modes to dynamically decide whether a port becomes a trunk:
• Desirable – the port will actively attempt to form a trunk with the
remote switch. This is the default setting.
• Auto – the port will passively wait for the remote switch to initiate the
trunk.
To configure the DTP mode on an interface:
Switch(config)# interface gi2/24
Switch(config-if)# switchport mode dynamic desirable
Switch(config-if)# switchport mode dynamic auto
Trunk ports send out DTP frames every 30 seconds to indicate their
configured mode.
A trunk will form in the following configurations:
• manual trunk manual trunk
• manual trunk dynamic desirable
• manual trunk dynamic auto
• dynamic desirable dynamic desirable
• dynamic desirable dynamic auto
A trunk will never form if the two sides of the trunk are set to dynamic auto,
as both ports are waiting for the other to initialize the trunk.
It is best practice to manually configure trunk ports, to avoid DTP
negotiation errors. DTP is also vulnerable to VLAN spoofing attacks.
To explicitly disable DTP:
Switch(config)# interface gi2/24
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport nonegotiate
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 13
<snip>
Note that VLANs 11-15 are not active. Most likely, no interfaces have been
assigned to those VLANs.
If there are no interfaces in an active trunking state, the show interface trunk
command will return no output.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 14
VTP Versions
There are three versions of VTP. VTP version 1 supports the standard 1 –
1005 VLAN range. VTP version 1 is also default on Catalyst switches.
VTP version 2 introduces some additional features:
• Token Ring support
• VLAN consistency checks
• Domain-independent transparent pass through
VTPv1 and v2 are not compatible. The VTP version is dictated by the VTP
server, discussed in detail shortly. If the VTP server is configured for
VTPv2, all other switches in the VTP domain will change to v2 as well.
Until recently, VTP Version 3 was supported on only limited Cisco switch
platforms. VTPv3 was built to be flexible, and can forward both VLAN and
other database information, such as Multiple Spanning Tree (MST) protocol.
Other enhancements provided by VTPv3 include:
• Support for the extended 1006-4094 VLAN range.
• Support for private VLANs.
• Improved VTP authentication.
• Protection from accidental database overwrites, by using VTP primary
and secondary servers.
• Ability to enable VTP on a per-port basis.
(Reference: http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst3560/software/release/12-2_52_se/configuration/guide/3560scg/swvtp.html)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 15
VTP Modes
A switch using VTP must operate in one of three modes:
• Server
• Client
• Transparent
VTP servers are responsible for creating, deleting, or modifying entries in
the VLAN database. Each VTP domain must have at least one VTP server,
and this is the default mode for Cisco switches.
Servers advertise the VLAN database to all other switches in the VTP
domain, including other servers. VTP servers can only advertise the standard
1-1005 VLAN range, and advertisements are only sent out trunk ports.
VTP clients cannot modify the VLAN database, and rely on advertisements
from other switches to update VLAN information. A client will also forward
VTP advertisements out every trunk port.
Remember: switches must be in the same VTP Domain to share and accept
updates to the VLAN database. Only servers can change the VLAN
database.
A VTP transparent switch maintains its own local VLAN database, and
does not directly participate in the VTP domain. A transparent switch will
never accept VLAN database information from another switch, even a
server. Also, a transparent switch will never advertise its local VLAN
database to another switch.
Transparent switches will pass through advertisements from other switches
in the VTP domain. The VTP version dictates how the pass through is
handled:
• VTP version 1 – the transparent switch will only pass through
advertisements from the same VTP domain.
• VTP version 2 – the transparent switch will pass through
advertisements from any VTP domain.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 16
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 17
(Reference: http://www.cisco.com/c/en/us/support/docs/lan-switching/vtp/10558-21.html#vtp_msg)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 18
Configuring VTP
By default, a switch is in VTP server mode, and joined to a blank domain
labeled NULL.
To change the VTP domain name:
Switch(config)# vtp domain MYDOMAIN
Note that the domain name is case sensitive. To configure the VTP mode:
Switch(config)# vtp mode server
Switch(config)# vtp mode client
Switch(config)# vtp mode transparent
The password is also case sensitive. All switches participating in the VTP
domain must be configured with the same password. The password is hashed
into a 16-byte MD5 digest.
Cisco switches use VTP version 1 by default, which is not compatible with
VTPv2. The VTP version is dictated by the VTP server, and if the server is
configured for VTPv2, all other switches in the VTP domain will change to
v2 as well.
Switch(config)# vtp version 2
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Virtual LANs (VLANs) and VTP v1.31 – Aaron Balchunas 19
VTP Pruning
Recall that Layer-2 switches belong to only one broadcast domain. A
Layer-2 switch will thus forward both broadcasts and multicasts out every
port in the same VLAN but the originating port. This includes sending out
broadcasts out trunk ports to other switches, which will in turn flood that
broadcast out all ports in the same VLAN.
VTP pruning eliminates unnecessary broadcast or multicast traffic
throughout the switching infrastructure. Consider the following example:
Assume that a host is connected to SwitchB, in VLAN 300. If the host sends
out a broadcast, SwitchB will forward the broadcast out every port in VLAN
300, including the trunk ports to SwitchA and SwitchC. Both SwitchA and
SwitchC will then forward that broadcast out every port in VLAN 300.
However, SwitchA does not have any ports in VLAN 300, and will drop the
broadcast. Thus, sending the broadcast to SwitchA is a waste of bandwidth.
VTP pruning allows a switch to learn which VLANs are active on its
neighbors. Thus, broadcasts are only sent out the necessary trunk ports
where those VLANs exist. In the preceding example, pruning would prevent
VLAN 300 broadcasts from being sent to SwitchA, and would prevent
VLAN 100 and 200 broadcasts from being sent to SwitchC.
VTP pruning is disabled by default on IOS switches. VTP pruning must be
enabled on a server, and will be applied globally to the entire VTP domain:
Switch(config)# vtp pruning
Both VLAN 1 and the system VLANs 1002-1005 are never eligible for
pruning. To manually specify which VLANs are pruning eligible on a trunk:
Switch(config)# interface gi2/24
Switch(config-if)# switchport trunk pruning vlan 2-10
Switch(config-if)# switchport trunk pruning vlan add 42
Switch(config-if)# switchport trunk pruning vlan remove 5
Switch(config-if)# switchport trunk pruning vlan except 100-200
Switch(config-if)# switchport trunk pruning vlan none
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
EtherChannel v1.11 – Aaron Balchunas 1
- EtherChannel -
Port Aggregation
A network will often span across multiple switches. Trunk ports are usually
used to connect switches together.
There are two issues with using only a single physical port for the trunk
connection:
• The port represents a single point of failure. If the port goes down,
the trunk connection is lost.
• The port represents a traffic bottleneck. All other ports on the switch
will use that one port to communicate across the trunk connection.
Thus, the obvious benefits of adding redundancy to the trunk connection are
fault tolerance and increased bandwidth, via load balancing.
However, simply trunking two or more ports between the switches will not
work, as this creates a switching loop. One of two things will occur:
• Spanning Tree Protocol (STP) will disable one or more ports to
eliminate the loop.
• If STP is disabled, the switching loop will result in an almost
instantaneous broadcast storm, crippling the network.
Port aggregation allows multiple physical ports to be bundled together to
form a single logical port. The switch and STP will treat the bundled ports as
a single interface, eliminating the possibility of a switching loop.
Cisco’s implementation of port aggregation is called EtherChannel.
EtherChannel supports Fast, Gigabit, and 10 Gigabit Ethernet ports.
A maximum of 8 active ports are supported in a single EtherChannel. If the
ports are operating in full duplex, the maximum theoretical bandwidth
supported is as follows:
• Fast Ethernet – 1600 Mbps
• Gigabit Ethernet – 16 Gbps
• 10 Gigabit Ethernet – 160 Gbps
The maximum number of supported EtherChannels on a single switch is
platform-dependent, though most support up to 64 or 128 EtherChannels.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
EtherChannel v1.11 – Aaron Balchunas 2
EtherChannel Requirements
The previous section described the benefits of port aggregation for a trunk
connection. However, EtherChannels can be formed with either access or
trunk ports. EtherChannels are also supported on Layer-3 interfaces.
Implementing an EtherChannel for access ports provides increased
bandwidth and redundancy to a host device, such as a server. However, the
host device must support a port aggregation protocol, such as LACP. Port
aggregation protocols are covered in great detail later in this guide.
Similarly, implementing EtherChannel for trunk connections provides
increased bandwidth and redundancy to other switches.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
EtherChannel v1.11 – Aaron Balchunas 3
EtherChannel Load-Balancing
Traffic sent across an EtherChannel is not evenly distributed across all ports
in the bundle. Instead, EtherChannel utilizes a load-balancing algorithm to
determine the port to send the traffic out, based on one of several criteria:
• Source IP address - src-ip
• Destination IP address - dst-ip
• Source and destination IP address - src-dst-ip
• Source MAC address - src-mac
• Destination MAC address - dst-mac
• Source and Destination MAC address - src-dst-mac
• Source TCP/UDP port number - src-port
• Destination TCP/UDP port number - dst-port
• Source and destination port number - src-dst-port
Using a deterministic algorithm prevents perfect load-balancing. However, a
particular traffic flow is forced to always use the same port in the bundle,
preventing out-of-order delivery.
The default load-balancing method for a Layer-2 EtherChannel is either src-
mac or src-dst-mac, depending on the platform. The default method for a
Layer-3 EtherChannel is src-dst-ip.
The load-balancing method must be configured globally on the switch:
Switch(config)# port-channel load-balance src-dst-mac
Assume that the load-balancing method is src-ip. The first port in the
EtherChannel will become Link0; the second will become Link1.
The two links in the EtherChannel can be represented in one binary bit. The
load-balancing algorithm will create an index that associates Link0 with a
binary bit of 0, and Link1 with a bit of 1.
As traffic passes through the EtherChannel, the algorithm will convert the
source IP addresses into a binary hash, to compare against the index. For
example, consider the following IP addresses and their binary equivalents:
10.1.1.2 00001010.00000001.00000001.00000010
10.1.1.3 00001010.00000001.00000001.00000011
Because there are only two ports in the EtherChannel, only one bit needs to
be considered in the IP address – the last bit. The first address ends with a 0
bit, and thus would be sent out Link0. The second address ends with a 1 bit,
and thus would be sent down Link1. Simple, right?
An EtherChannel that contained four ports would require a 2-bit index,
requiring that the last two bits of the IP address be considered:
Link0 00
Link1 01
Link2 10
Link3 11
Best practice dictates that EtherChannels should contain an even number of
ports, to promote uniform load-balancing. An EtherChannel can support an
odd number of ports; however, this may result in one of the ports being
severely overburdened due to uneven load-balancing.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
EtherChannel v1.11 – Aaron Balchunas 5
This time, assume that the load-balancing method is src-dst-ip. Again, the
first port in the EtherChannel will become Link0; the second will become
Link1.
Both the source and destination IP must be considered when choosing a link.
This requires performing an exclusive OR (XOR) operation. In an XOR
operation, if the two values being compared are equal, the result is 0. If the
two values are not equal, the result is 1.
The following illustrates all possible results with a 1-bit index:
Source 0 1 0 1
Destination 0 0 1 1
Result 0 1 1 0
The XOR result of the above address pair would be 1. Thus, the traffic
would be sent out Link1.
The following illustrates all possible results with a 2-bit index, representing
four ports:
Source 00 00 00 00 01 01 01 01 10 10 10 10 11 11 11 11
Destination 00 01 10 11 00 01 10 11 00 01 10 11 00 01 10 11
Result 00 01 10 11 01 00 11 10 10 11 00 01 11 10 01 00
There are four possible results (00, 01, 10, 11), corresponding to the four
ports in the EtherChannel.
Regardless of the load-balancing method used, STP will always send its
packets through the first operational port in an EtherChannel bundle.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
EtherChannel v1.11 – Aaron Balchunas 6
EthernChannel - PAgP
PAgP is a Cisco-proprietary aggregation protocol, and supports two modes:
• Desirable – actively attempts to form a channel
• Auto – waits for the remote switch to initiate the channel
A PAgP channel will form in the following configurations:
• desirable desirable
• desirable auto
A channel will not form if both sides are set to auto. Also, PAgP will not
form a channel if the remote side is running LACP, or manually configured.
To create an EtherChannel using PAgP negotiation:
Switch(config)# interface range gi2/23 – 24
Switch(config-if)# channel-protocol pagp
Switch(config-if)# channel-group 1 mode desirable
Switch(config-if)# channel-group 1 mode auto
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
EtherChannel v1.11 – Aaron Balchunas 8
EtherChannel - LACP
LACP is an IEEE standard aggregation protocol, and supports two modes:
• Active – actively attempts to form a channel
• Passive – waits for the remote switch to initiate the channel
An LACP channel will form in the following configurations:
• active active
• active passive
A channel will not form if both sides are set to passive. Also, LACP will
not form a channel if the remote side is running PAgP, or manually
configured.
To create an EtherChannel using LACP negotiation:
Switch(config)# interface range gi2/23 – 24
Switch(config-if)# channel-protocol lacp
Switch(config-if)# channel-group 1 mode active
Switch(config-if)# channel-group 1 mode passive
LACP requires that speed, duplex, VLAN, and STP configuration be
configured identically across all participating ports.
Recall that a maximum of 8 active ports are supported in a single
EtherChannel. LACP supports adding an additional 8 ports into the bundle
in a standby state, to replace an active port if it goes down.
LACP assigns a numerical port-priority to each port, to determine which
ports become active in the EtherChannel. By default, the priority is set to
32768, and a lower priority is preferred. If there is a tie in port-priority, the
lowest port number is preferred.
To change the LACP port-priority to something other than default:
Switch(config)# interface range gi2/23 – 24
Switch(config-if)# lacp port-priority 100
LACP also assigns a system-priority to each switch, dictated which switch
becomes the decision-maker if there is a conflict about active ports. The
default system-priority is 32768, and a lower priority is again preferred. If
there is a tie in system-priority, the lowest switch MAC address is preferred.
To globally change the system-priority on a switch:
Switch(config)# lacp system-priority 500
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
EtherChannel v1.11 – Aaron Balchunas 9
Troubleshooting EtherChannel
To view status information on all configured EtherChannels:
Switch# show etherchannel summary
Note that both ports have a status of P, which indicates that they are up and
active in the EtherChannel.
On Cisco Nexus switches, the syntax for this command is slightly different:
NexusSwitch# show port-channel summary
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 1
If HostA sends out a broadcast, SwitchD will forward the broadcast out all
ports in the same VLAN, including the trunk ports connecting to SwitchB
and SwitchE. In turn, those two switches will forward that broadcast out all
ports, including the trunks to the neighboring SwitchA and SwitchC.
The broadcast will loop around the switches infinitely. In fact, there will be
two separate broadcast storms cycling in opposite directions through the
switching loop. Only powering off the switches or physically removing the
loop will stop the storm.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 2
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 3
SwitchB SwitchC
Priority: 32,768 Priority: 32,768
MAC: 0000.2222.3333 MAC: 0000.6666.7777
SwitchD SwitchE
Priority: 100 Priority: 32,768
MAC: 0000.4444.5555 MAC: 0000.8888.9999
Switches exchange BPDU’s to perform the election process, and the lowest
Bridge ID determines the Root Bridge:
• SwitchB, SwitchC, and SwitchE have the default priority of 32,768.
• SwitchA and SwitchD are tied with a lower priority of 100.
• SwitchA has the lowest MAC address, and will be elected the Root
Bridge.
By default, a switch will always believe it is the Root Bridge, until it
receives a BPDU from a switch with a lower Bridge ID. This is referred to
as a superior BPDU. The election process is continuous – if a new switch
with the lowest Bridge ID is added to the topology, it will be elected as the
Root Bridge.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 4
Each 1Gbps link has a path cost of 4. SwitchA has a cumulative path cost of
0, because it is the Root Bridge. Thus, when SwitchA sends out BPDU’s, it
advertises a root path cost of 0.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 5
The lowest cumulative path cost is considered superior, thus the port
directly connecting to SwitchA will become the root port. A BPDU
advertising a higher path cost is often referred to as an inferior BPDU.
SwitchD also has two paths to the Root Bridge:
• A path through SwitchB, with a path cost of 8.
• A path through SwitchE, with a path cost of 12.
• The port to SwitchB is preferred, and will become the root port.
Recall that the Root Bridge will advertise BPDU’s with a path cost of 0. As
the downstream switches receive these BPDU’s, they will add the path cost
of the receiving port, and then advertise the cumulative cost to neighbors.
For example, SwitchC will receive a BPDU with a path cost of 0 from
SwitchA, which is the Root Bridge. SwitchC will add the path cost of its
receiving port, and thus SwitchC’s cumulative path cost will be 4.
SwitchC will advertise a path cost of 4 to SwitchE, which will add the path
cost of its receiving port. SwitchE’s cumulative path cost will thus be 8.
Path cost can be artificially adjusted on a per-port basis:
SwitchD(config)# int gi2/22
SwitchD(config-if)# spanning-tree vlan 101 cost 42
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 6
Ports on the Root Bridge are never placed in a blocking state. Thus, the two
ports off of SwitchA will automatically become designated ports.
Remember, every network segment must have one designated port,
regardless if a root port already exists on that segment.
Thus, the network segments between SwitchB and SwitchD, and between
SwitchC and SwitchE, both require a designated port. The ports on SwitchD
and Switch E have already been identified as root ports, thus the ports on
Switch B and C will become the designated ports.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 7
Because two ports on this segment are eligible to become the designated
port, STP recognizes that a loop exists. One of the ports must be elected as
the designated port, and the other must be placed in a blocking state.
Normally, whichever switch has the lowest cumulative path cost will have
its port become designated. The switch with the highest path cost will have
its port blocked.
In the above example, there is a tie in cumulative path cost. Both SwitchD
and SwitchE have a path cost of 12 to reach the Root Bridge on that
segment.
The lowest Bridge ID is used as the tiebreaker. SwitchD has a priority of
100, and SwitchE has the default priority of 32,768.
Thus, the port on SwitchD will become the designated port. The port on
SwitchE will be placed in a blocking state.
As with electing the Root Bridge, if there is a tie in priority, the lowest
MAC address is used as the tie breaker.
Remember: Any port not elected as a root or designated port will be placed
in a blocking state.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 8
Port ID
When electing root and designated ports, it is possible to have a tie in both
path cost and Bridge ID. Consider the following example:
The bandwidth of both links is equal, thus both ports on SwitchB have an
equal path cost to the Root Bridge. Which port will become the root port
then? Normally, the lowest Bridge ID is used as the tiebreaker, but that is
not possible in this circumstance.
Port ID is used as the final tiebreaker, and consists of two components:
• 4-bit port priority
• 12-bit port number, derived from the physical port number
By default, the port priority of an interface is 128, and a lower priority is
preferred. If there is a tie in priority, the lowest port number is preferred.
The sender port ID determines the tie break, and not the local port ID. In the
above example, SwitchB must decide whether gi2/23 or gi2/24 becomes the
root port. SwitchB will observe BPDU’s from SwitchA, which will contain
the port ID’s for gi2/10 and gi2/11.
If priorities are equal, the sender Port ID from gi2/10 is preferred, due to the
lower port number. Thus, gi2/23 on SwitchB will become the root port.
The port number is a fixed value, but port priority can be changed on a per-
interface basis:
Switch(config)# int gi2/11
Switch(config-if)# spanning-tree vlan 101 port-priority 32
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 9
Port ID (continued)
Note: Some reference material may state that the Port ID is comprised of an
8-bit priority and 8-bit port number. This was accurate in the original
802.1D specification.
However, IEEE 802.1t revised the original specification to provide the
larger 12-bit port number field, to accommodate modular switches with high
port density.
Even more confusing – some whitepapers on Cisco’s website will define the
Port ID as a combination of port priority and MAC address, instead of port
number. This is not accurate in modern STP implementations.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 10
Versions of STP
There are three flavors of the original 802.1D version of STP:
• Common Spanning Tree (CST)
• Per-VLAN Spanning Tree (PVST)
• Per-VLAN Spanning Tree Plus (PVST+)
CST utilizes a single STP instance for all VLANs, and is sometimes referred
to as mono spanning tree. All CST BPDU’s are sent over the native VLAN
on a trunk port, and thus are untagged.
PVST employs a separate STP instance for each VLAN, improving
flexibility and performance. PVST requires trunk ports to use ISL
encapsulation. PVST and CST are not compatible.
The enhanced PVST+ is compatible with both CST and PVST, and supports
both ISL and 802.1Q encapsulation. PVST+ is the default mode on many
Cisco platforms.
STP has continued to evolve over time. Modern extensions of STP will be
covered later in this guide:
• Rapid Spanning Tree Protocol (RSTP)
• Multiple Spanning Tree (MST)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 11
Extended system IDs increase the number of supported VLANs in the STP
topology from 1005 to 4094.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 12
The switch with the lowest Bridge ID is elected as the Root Bridge. The
priority can be adjusted from its default of 32,768, to increase the likelihood
that a switch is elected as the Root Bridge.
Priority can be configured on a per-VLAN basis. Remember that the priority
must be in multiples of 4,096 when extended system IDs are enabled:
SwitchA(config)# spanning-tree vlan 101 priority 8192
A switch can be indirectly forced to become the Root Bridge for a specific
VLAN:
SwitchA(config)# spanning-tree vlan 101 root primary
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 14
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 15
STP Timers
Switches running STP exchange BPDUs to build and converge the topology
database. There are three timers that are crucial to the STP process:
• Hello timer
• Forward delay timer
• Max age timer
The hello timer determines how often switches send BPDUs. By default,
BPDUs are sent every 2 seconds.
The forward delay timer determines how long a port must spend in both a
learning and listening state:
• Introducing this delay period ensures that STP will have enough time
to detect and eliminate loops.
• By default, the forward delay is 15 seconds.
• Because a port must transition through two forward delays, the total
delay time is 30 seconds.
The max age timer indicates how long a switch will retain BPDU
information from a neighbor switch, before discarding it:
• Remember that BPDUs are sent every two seconds.
• If a switch fails to receive a BPDU from a neighboring switch for the
max age period, it will assume there was a change in the switching
topology.
• STP will then purge that neighbor’s BPDU information.
• By default, the max age timer is 20 seconds.
Timer values can be adjusted. However, this is rarely necessary, and can
negatively impact STP performance and reliability.
Timers must be changed on the Root Bridge. The Root Bridge will
propagate the new timer values to all switches using BPDUs. Non-root
switches will ignore their locally configured timer values.
To manually adjust the three STP timers for a specific VLAN:
Switch(config)# spanning-tree vlan 101 hello-time 10
Switch(config)# spanning-tree vlan 101 forward-time 20
Switch(config)# spanning-tree vlan 101 max-age 40
The timer values are measured in seconds, and the above represents the
maximum possible value for each timer.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 16
STP Diameter
The default values of each STP timer are based on the diameter of the
switching topology.
The diameter is the length of the topology, measured in the number of
switches including the Root Bridge. The following example has a diameter
of 4 switches:
SwitchA
Root Bridge
SwitchB
SwitchC
SwitchD
The diameter command adjusts the hello, forward delay, and max age
timers. This is the recommended way to adjust timers, as the timers are
tuned specifically to the diameter of the switching network.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 17
When a switch receives this root BPDU, it will temporarily reduce its CAM
aging timer from 300 seconds to a value equal to the forward delay timer -
15 seconds by default. This allows any erroneous MAC addresses to be
quickly flushed from the CAM table.
The CAM aging timer will remain at a reduced value for the duration of one
forward delay plus one max age period – a total of 35 seconds by default.
Two types of failures can occur in the STP topology, depending on the
perspective of a switch:
• Direct failures
• Indirect failures
For example, if the root port on SwitchB fails, SwitchB would consider this
a direct failure. SwitchB will detect immediately that the physical port is
down, and STP will react accordingly.
That same port failing would represent an indirect failure for SwitchD.
SwitchD would lose its path to the Root Bridge. However, because the port
is not local on SwitchD, it must learn of the topology change from its
neighbors.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 19
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 20
PortFast
By default, all ports on a switch participate in the STP topology. This
includes any port that connects to a host, such as a workstation. In most
circumstances, a host represents no risk of a loop.
The host port will transition through the normal STP states, including
waiting two forward delay times. Thus, a host will be without network
connectivity for a minimum of 30 seconds when first powered on.
This is not ideal for a couple reasons:
• Users will be annoyed by the brief outage.
• A host will often request an IP address through DHCP during bootup.
If the switch port is not forwarding quickly enough, the DHCP
request may fail.
• Devices that boot from network may fail as well.
PortFast allows a switch port to bypass the usual progression of STP states.
The port will instead transition from a blocking to a forwarding state
immediately, eliminating the typical 30 second delay.
PortFast should only be enabled on ports connected to a host. If enabled on a
port connecting to a switch or hub, any loop may result in a broadcast storm.
Note: PortFast does not disable STP on a port - it merely accelerates STP
convergence. If a PortFast-enabled port receives a BPDU, it will transition
through the normal process of STP states.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 21
PortFast (continued)
SwitchA
Root Bridge
SwitchB SwitchC
SwitchD SwitchE
gi1/14
HostA
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 22
UplinkFast
Often, a switch will have multiple uplinks to another upstream switch:
SwitchA
Root Bridge
gi2/23 gi2/24
SwitchB
If the links are not bundled using an EtherChannel, at least one of the ports
will transition to a blocking state to eliminate the loop. In the above
example, port gi2/24 was placed into a blocking state on SwitchB.
Normally, if the root port fails on the local switch, STP will need to perform
a recalculation to transition the other port out of a blocking state. At a
minimum, this process will take 30 seconds.
UplinkFast allows a blocking port to be held in a standby state. If the root
port fails, the blocking port can immediately transition to a forwarding state.
Thus, UplinkFast improves convergence time for direct failures in the STP
topology.
If multiple ports are in a blocking state, whichever port has the lowest root
path cost will transition to forwarding.
UplinkFast is disabled by default, and must be enabled globally for all
VLANs on the switch:
Switch(config)# spanning-tree uplinkfast
UplinkFast functions by tracking all possible links to the Root Bridge. Thus,
UplinkFast is not supported on the Root Bridge. In fact, enabling this
feature will automatically increase a switch’s bridge priority to 49,152.
UplinkFast is intended for the furthest downstream switches in the STP
topology.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 23
BackboneFast
UplinkFast provides faster convergence if a directly-connected port fails. In
contrast, BackboneFast provides improved convergence if there is an
indirect failure in the STP topology.
If the link between SwitchB and SwitchA fails, SwitchD will eventually
recalculate a path through SwitchE to reach the Root Bridge. However,
SwitchD must wait the max age timer before purging SwitchB’s superior
BPDU information. By default, this is 20 seconds.
BackboneFast allows a switch to bypass the max age timer. The switch will
accept SwitchE’s inferior BPDU’s immediately. The blocked port on
SwitchE must still transition to a forwarding state. Thus, BackboneFast
essentially reduces total convergence time from 50 seconds to 30 seconds for
an indirect failure.
This is accomplished by sending out Root Link Queries (RLQs). The Root
Bridge will respond to these queries with a RLQ Reply:
• If a RLQ Reply is received on a root port, the switch knows that the
root path is stable.
• If a RLQ Reply is received on a non-root port, the switch knows that
the root path has failed. The max age timer is immediately expired to
allow a new root port to be elected.
BackboneFast is a global command, and should be enabled on every switch:
Switch(config)# spanning-tree backbonefast
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 24
Protecting STP
STP is vulnerable to attack for two reasons:
• STP builds the topology by accepting BPDUs from neighboring
switches.
• The Root Bridge is always determined by the lowest Bridge ID.
A switch with a low priority can be maliciously or inadvertently installed on
the network, and then elected as the Root Bridge. STP will reconverge, often
resulting in instability or a suboptimal topology.
Cisco implemented three mechanisms to protect the STP topology:
• Root Guard
• BPDU Guard
• BPDU Filtering
All three mechanisms are configured on a per-port basis, and are disabled by
default.
Root Guard
Root Guard prevents an unauthorized switch from advertising itself as a
Root Bridge. If a BPDU superior to the Root Bridge is received on a port
with Root Guard enabled, the port is placed in a root-inconsistent state.
In this state, the port is essentially in a blocking state, and will not forward
frames. The port can still listen for BPDUs.
Root Guard is enabled on a per-port basis, and is disabled by default:
Switch(config)# interface gi1/14
Switch(config-if)# spanning-tree guard root
BPDU Guard
Recall that PortFast allows a switch port to bypass the usual progression of
STP states. However, PortFast does not disable STP on a port - it merely
accelerates STP convergence. However, a PortFast-enabled port will still
accept BPDUs.
PortFast should only be enabled on ports connected to a host. If enabled on a
port connecting to a switch, any loop may result in a broadcast storm.
To prevent such a scenario, BPDU Guard can be used in conjunction with
PortFast. Under normal circumstances, a port with PortFast enabled should
never receive a BPDU, as it is intended only for hosts.
BPDU Guard will place a port in an errdisable state if a BPDU is received,
regardless if the BPDU is superior or inferior. The STP topology will not be
impacted by another switch that is inadvertently connected to that port.
BPDU Guard should be enabled on any port with PortFast enabled. It is
disabled by default, and can be enabled on a per-interface basis:
Switch(config)# interface gi1/14
Switch(config-if)# spanning-tree bpduguard enable
BPDUs will still be sent out ports enabled with BPDU Guard.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 26
BPDU Filtering
BPDU Filtering prevents BPDUs from being sent out a port, and must be
enabled in conjunction with PortFast.
If a BPDU is received on a port, BPDU Filtering will react one of two ways,
depending on how it was configured.
• If filtering is enabled globally, a received BPDU will disable PortFast
on the port. The port will then transition normally through the STP
process.
• If filtering is enabled on a per-interface basis, a received BPDU is
ignored.
Great care must be taken when manually enabling BPDU Filtering on a port.
Because the port will ignore a received BPDU, STP is essentially disabled.
The port will neither be err-disabled nor progress through the STP process,
and thus the port is susceptible to loops.
If BPDU Filtering is enabled globally, it will only apply to PortFast ports:
Switch(config)# spanning-tree portfast bpdufilter default
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 27
The enable parameter sets UDLD into normal mode, and the aggressive
parameter is for aggressive mode. The message time parameter modifies
how often ID frames are sent out, measured in seconds.
UDLD can be configured on a per-interface basis:
Switch(config-if)# udld enable
Switch(config-if)# udld aggressive
Switch(config-if)# udld disable
To view UDLD status on ports, and reset any ports disabled by UDLD:
Switch# show udld
Switch# udld reset
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 28
Loop Guard
STP relies on the exchange of BPDUs to maintain a loop free environment.
If a software or hardware failure causes a switch to stop receiving BPDUs, a
switch will eventually discard that BPDU information, after the max age
timer has expired.
This may result in the switch incorrectly transitioning a blocking port to a
forwarding state, thus creating a loop.
UDLD addresses only one of the possible causes of this scenario – a
unidirectional link. Other issues may prevent BPDUs from being received or
processed, such as the CPU on a switch being at max utilization.
Loop Guard provides a more comprehensive solution – if a blocking port
stops receiving BPDUs on a VLAN, it is moved into a loop-inconsistent
state for that VLAN.
A port in a loop-inconsistent state cannot forward traffic for the affected
VLANs, and is essentially in a pseudo-errdisable state.
However, Loop Guard can automatically recover. As soon as BPDUs are
received again, the port will transition normally through STP states.
Loop Guard can be enabled globally:
Switch(config)# spanning-tree loopguard default
Loop Guard should only be enabled on trunk ports, or ports that connect to
other switches. Loop Guard should never be enabled on a port connecting to
a host, as an access port should never receive a BPDU.
(Reference: http://astorinonetworks.com/2011/09/01/understanding-spanning-tree-loopguard/)
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 29
Troubleshooting STP
To view general STP information for all VLANs:
Switch# show spanning-tree
VLAN0101
Spanning tree enabled protocol ieee
Root ID Priority 32869
Address 000a.f43b.1b80
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Topology for
All VLANs
SwitchB
If a port on SwitchB enters a blocking state to eliminate the loop, that port
will block traffic from all VLANs. Redundancy is not lost, as STP will
recognize if the non-blocked port goes down, and reactivate the blocked
port.
However, this is inefficient, as the potential bandwidth of the blocked port is
unavailable for any VLAN. In contrast, PVST supports load balancing
VLANs across the switching topology:
PVST runs a separate instance for each VLAN, allowing a port to enter a
blocking state only for that specific VLAN. This provides both redundancy
and more efficient use of available bandwidth.
Note: An even better solution for the above example is to use an
EtherChannel, which STP will treat as a single logical interface.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 31
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 34
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Spanning Tree Protocol v1.31 – Aaron Balchunas 35
All other MST parameters are configured identically to 802.1D STP, with
two exceptions:
• The mst parameter must be used on all commands
• All commands reference the MST instance instead of a VLAN.
Thus, to configure a switch as the Root Bridge for MST instance 2:
Switch(config)# spanning-tree mst 2 root primary
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Multilayer Switching v1.21 – Aaron Balchunas 1
- Multilayer Switching -
Routing Between VLANs
By default, a switch will forward both broadcasts and multicasts out every
port but the originating port. However, a switch can be logically segmented
into separate broadcast domains, using Virtual LANs (or VLANs).
Each VLAN represents a unique broadcast domain:
• Traffic between devices within the same VLAN is switched.
• Traffic between devices in different VLANs requires a Layer-3
device to communicate.
There are three methods of routing between VLANs. The first method
involves using an external router with a separate physical interface in each
VLAN. This is the least scalable solution, and impractical for environments
with a large number of VLANs:
The second method involves using an external router with a single trunk
link to the switch, over which all VLANs can be routed. The router must
support either 802.1Q or ISL encapsulation. This method is known as
router-on-a-stick:
The final method involves using a multilayer switch, which supports both
Layer-2 and Layer-3 forwarding:
Configuring Router-on-a-Stick
Consider the following router-on-a-stick example:
SwitchA
gi0/1 gi1/10
< Trunking VLANs 101,102 >
gi1/14 gi1/15
RouterA
HostA HostB
VLAN 101 VLAN 102
HostA HostB
VLAN 101 VLAN 102
A routed port behaves exactly like a physical router interface, and is not
associated with a VLAN. The no switchport command configures an
interface as a routed port, allowing an IP address to be assigned:
Switch(config)# interface gi1/20
Switch(config-if)# no switchport
Switch(config-if)# ip address 10.101.101.1 255.255.255.0
SVIs are the most common method of configuring inter-VLAN routing. The
logical VLAN interface will not become online unless:
• The VLAN is created.
• At least one port is active in the VLAN.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Multilayer Switching v1.21 – Aaron Balchunas 5
The IP address on each SVI represents the gateway for hosts on each
VLAN. The two networks will be added to the routing table as directly
connected routes.
Remember: an SVI requires at least one port to be active in the VLAN:
SwitchA(config)# interface gi1/14
SwitchA(config-if)# switchport mode access
SwitchA(config-if)# switchport access vlan 101
SwitchA(config-if)# no shut
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Multilayer Switching v1.21 – Aaron Balchunas 7
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Multilayer Switching v1.21 – Aaron Balchunas 8
The most specific entries are installed at the top of the table. Note that each
FIB entry contains the following information:
• The destination prefix
• The destination mask
• The next-hop address
• The local interface where the next-hop exists
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switched Port Analyzer (SPAN) v1.11 – Aaron Balchunas 1
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switched Port Analyzer (SPAN) v1.11 – Aaron Balchunas 3
Configuring SPAN
Configuring SPAN involves two steps:
• Identifying the SPAN source or sources
• Identifying the SPAN destination
To configure SPAN sources:
Switch(config)# monitor session 1 source interface gi0/10 rx
Switch(config)# monitor session 1 source interface gi0/11 tx
Switch(config)# monitor session 1 source vlan 100 both
Remember, the session number must match between the source and
destination. To disable a specific monitoring session:
Switch(config)# no monitor session 1
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switched Port Analyzer (SPAN) v1.11 – Aaron Balchunas 4
The SPAN source exists on SwitchA, and the SPAN destination exists on
SwitchC. Each switch must be configured with the RSPAN VLAN,
including the intermediary SwitchB.
To configure RSPAN on SwitchA:
SwitchA(config)# vlan 200
SwitchA(config-vlan)# remote-span
SwitchA(config)# monitor session 1 source interface gi0/10
SwitchA(config)# monitor session 1 destination vlan 200
Note that on SwitchA, the SPAN destination is the RSPAN VLAN, instead
of a port. On SwitchC, the SPAN source is the RSPAN VLAN.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch and VLAN Security v1.51 – Aaron Balchunas 1
Only hosts configured with the above two MAC addresses will be allowed to
send traffic through this port.
If the maximum number of MAC addresses for this port had been set to 10,
but only two were statically mapped, the switch would dynamically learn the
remaining eight MAC addresses.
Port Security refers to dynamically learned MAC addresses as sticky
addresses. Sticky addresses can be aged out after a period of inactivity,
measured in minutes:
Switch(config-if)# switchport port-security aging time 10
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch and VLAN Security v1.51 – Aaron Balchunas 2
Note that the maximum MAC addresses is set to 10, and that the total MAC
addresses is currently at 10 as well. The violation mode is set to shutdown.
If another MAC address attempts to forward traffic through this port, the
port will be place in an errdisable state.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch and VLAN Security v1.51 – Aaron Balchunas 3
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch and VLAN Security v1.51 – Aaron Balchunas 4
VLAN Access-Lists
Normally, access-lists are applied to interfaces to filter traffic between
networks or VLANs.
VLAN Access-Lists (VACLs) filter traffic within a VLAN. Because intra-
VLAN traffic does not traverse an interface, it cannot be directly filtered
using a normal access-list.
For a VACL to function, traffic must first be identified using an access-list:
Switch(config)# ip access-list extended BLOCKTHIS
Switch(config-ext-nacl)# permit ip host 10.1.5.10 10.1.0.0 0.0.255.255
The first line creates a vlan access-map named MY_VACL. Traffic that
matches entries in the BLOCKTHIS access-list will be dropped.
The final vlan access-map entry contains only an action to forward. This
will apply to all other traffic, as no other access-list was specified. Finally
the VACL is applied to VLAN 102.
Notice that every access-map statement contains a sequence number - 5 and
10 respectively in the above example. This dictates the order in which the
rules should be processed.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch and VLAN Security v1.51 – Aaron Balchunas 5
Private VLANs
Private VLANs (PVLANs) allow for further segmentation of a subnet
within a VLAN. This is accomplished by creating secondary VLANs within
a primary VLAN.
The secondary VLAN can communicate only with the primary VLAN, and
not any other secondary VLANs.
There are two types of secondary VLANs:
• Community
• Isolated
Hosts within a community VLAN can communicate with each other, and
with the primary VLAN.
Hosts within an isolated VLAN cannot communicate with each other.
However, the hosts can still communicate with the primary VLAN.
Private VLANs are only locally-significant to the switch. VTP will not pass
information on Private VLANs to other switches.
Each switch port in a private VLAN must be configured with a specific
mode:
• Promiscuous
• Host
A promiscuous port can communicate with the primary VLAN and all
secondary VLANs. Gateway devices such as routers and switches should be
configured as promiscuous ports.
A host port can communicate only with promiscuous ports, and other ports
within the local community VLAN. Host devices such as workstations
should be configured as host ports.
Private VLANs allow a group of hosts to be segmented within a VLAN,
while still allowing those devices to reach external networks via a
promiscuous gateway.
Service providers can use private VLANs to segregate the traffic of multiple
customers, while allowing them to share a gateway.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch and VLAN Security v1.51 – Aaron Balchunas 6
The gi1/10 port has been identified as a host port, and associated with
primary VLAN 50, and secondary VLAN 101.
To configure a promiscuous port:
Switch(config)# interface gi1/20
Switch(config-if)# switchport private-vlan promiscuous
Switch(config-if)# switchport private-vlan mapping 50 100.101
The promiscuous gi1/20 port is associated with primary VLAN 50, and the
two secondary VLANs, 100 and 101.
To allow the primary VLAN SVI to perform Layer-3 forwarding for
specified secondary VLANs:
Switch(config)# interface vlan 50
Switch(config-if)# private-vlan mapping 100,101
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch and VLAN Security v1.51 – Aaron Balchunas 7
DHCP Snooping
Dynamic Host Control Protocol (DHCP) provides administrators with a
mechanism to dynamically assign IP addresses, rather than manually
configuring the address on each host.
DHCP servers lease out IP addresses to DHCP clients, for a specific period
of time. There are four steps to this DHCP process:
• When a DHCP client first boots up, it broadcasts a DHCPDiscover
message, searching for a DHCP server.
• If a DHCP server exists on the local segment, it will respond with a
DHCPOffer, containing the offered IP address, subnet mask, etc.
• Once the client receives the offer, it will respond with a
DHCPRequest, indicating that it will accept the offered protocol
information.
• Finally, the server responds with a DHCPACK, acknowledging the
clients acceptance of offered protocol information.
Malicious attackers can place a rogue DHCP server on the trusted network,
intercepting DHCP packets while masquerading as a legitimate DHCP
server. This is a form of spoofing attack, which intends to gain unauthorized
access or steal information by sourcing packets from a trusted source. This is
also referred to as a man-in-the-middle attack.
DHCP attacks of this sort can be mitigated by using DHCP Snooping. Only
specified interfaces will accept DHCPOffer packets – unauthorized
interfaces will discard these packets, and then place the interface in an
errdisable state.
DHCP Snooping must first be globally enabled on the switch:
Switch(config)# ip dhcp snooping
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.
Switch and VLAN Security v1.51 – Aaron Balchunas 8
If an ARP response does not match the MAC-to-IP entry for a particular IP
address, then DAI drops the ARP response and generates a log message.
***
All original material copyright © 2014 by Aaron Balchunas (aaron@routeralley.com),
unless otherwise noted. All other material copyright © of their respective owners.
This material may be copied and used freely, but may not be altered or sold without the expressed written
consent of the owner of the above copyright. Updated material may be found at http://www.routeralley.com.