CCIE Enterprise Infrastructure
CCIE Enterprise Infrastructure
1|Page
CCIE Enterprise Infrastructure
Unit 1: Network Infrastructure
1.1: Switched Campus
1.1.a: Switch Administration
How does a switch learn MAC Addresses?
A switch has some intelligence and operates on layer 2 of the OSI model. In this
lesson, I’ll demonstrate how a switch learns MAC addresses. Let me show you an
example of three computers connected to a switch:
There’s a switch in the middle and we have 3 computers. All computers have a MAC
address, but I’ve simplified them. Our switch has a MAC address table and it will learn
where all the MAC addresses are in the network. Let’s send something from H1 to H2:
H1 is going to send some data meant for H2, thus it will create an Ethernet frame which
has a source MAC address (AAA) and a destination MAC address (BBB). Our switch
has a MAC address table and here’s what will happen:
2|Page
Our switch will build a MAC address table and only learns from source MAC
addresses. At this moment it just learned that the MAC address of H1 is on interface 1.
It will now add this information in its MAC address table. As you can see our switch
currently has no information where H2 is located. There’s only one option left….
flood this frame out of all its interfaces except the one where it came from. H2 and H3
will receive this Ethernet frame.
Since H2 sees its MAC address as the destination of this Ethernet frame it knows it’s
meant for him, H3 will discard it. H2 is going to respond to H1, build an Ethernet frame
and send it towards our switch. At this moment the switch will learn the MAC address of
H2.
That’s the end of our story, the switch now knows both MAC addresses and the next
time it can “switch” instead of flooding Ethernet frames. H3 will never see any frames
between H1 and H2 except for the first one which was flooded.
1. Verification
Let me show you what this looks like on a real Cisco switch. I will use a topology with
one switch and three host devices:
3|Page
Let’s verify if all interfaces are up and running:
All interfaces are connected, let’s check the MAC address table:
The show mac address-table dynamic command gives us all MAC addresses that the
switch has learned dynamically. We can see it has learned three MAC addresses.
There are a couple of parameters we can use with this command. For example:
4|Page
1 fa16.3e15.d86d DYNAMIC Gi0/1
This only gives us the output for the MAC address of H1. We can also get an overview of
all MAC addresses that were learned on a single interface:
This shows interface GigabitEthernet0/2 with the MAC address of H2. Here’s how you
can see the default aging time:
If the switch doesn’t see a particular MAC address for 300 seconds, it will be removed
from the MAC address table.
What if we want to manually remove something from the MAC address table? This is
possible with the clear mac address-table command:
You can choose if you want to remove a single MAC address, all MAC address on a
particular interface or that belong to one VLAN. If you don’t add any parameters then it
will remove all MAC addresses. Let’s try that:
5|Page
Vlan Mac Address Type Ports
---- ----------- -------- -----
Let’s send a ping from H1 to H2 to check if our switch is able to learn their MAC
addresses:
H1#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 9/9/10 ms
Take a look at the output of these two switches, especially their GigabitEthernet0/3
interfaces:
6|Page
SW1#show mac address-table dynamic
Mac Address Table
-------------------------------------------
As you can see above, SW1 has learned the MAC addresses of H3 and H4 on its
GigabitEthernet0/3 interface. SW2 has learned the addresses of H1 and H2:
This is just a quick example to explain that a switch is able to learn multiple MAC
addresses on a single interface.
I hope this lesson has been useful to understand the MAC address table of your Cisco
Catalyst switch.
Normally your switch will automatically learn MAC addresses and fill its MAC address
table (CAM table) by looking at the source MAC address of incoming frames and
flooding frames if it doesn’t know where to forward the frame.
This process is vulnerable to layer 2 MAC address spoofing attacks where an attacker
spoofs a certain MAC address to change entries in the MAC address table. A really
simple method to deal with this issue is to manually configure entries in the MAC
address table, a static entry will always overrule dynamic entries. You can either specify
the interface where the MAC address is located or tell the switch to drop the traffic.
Let’s look at an example!
7|Page
To demonstrate this, we only require two devices. A router to generate some traffic and
a switch to look at (and configure) the MAC address table. Here’s the configuration:
SW1(config)#interface vlan 1
SW1(config-if)#no shutdown
SW1(config-if)#ip address 192.168.12.2 255.255.255.0
We’ll do a quick ping to generate some traffic so SW1 can learn about the mac address
of R1’s FastEthernet 0/0 interface:
R1#ping 192.168.12.2
Here’s the MAC address of R1, learned dynamically. Let’s turn this into a static entry:
Use the mac address-table static command to create a static entry. Here’s what the
MAC address table looks like now:
8|Page
There it is, a static entry. No way to overrule this unless you have access to our switch.
This prevents us from moving R1 to another interface on SW1 unless we change the
static entry. Like I mentioned before we can also change a static entry so it will drop all
traffic. Here’s how to do it:
All frames destined for the MAC address of R1 will now be dropped:
R1#ping 192.168.12.2
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
ip cef
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
end
hostname SW1
!
interface Vlan1
ip address 192.168.12.2 255.255.255.0
!
mac address-table static 001d.a18b.36d0 vlan 1 drop
end
Maximum Transmission Unit (MTU) is the largest size in bytes that a certain layer can
forward. The MTU is different for each protocol and medium that we use. Ethernet for
example has a MTU of 1500 bytes by default.
This means that a single Ethernet frame can carry up to 1500 bytes of data. On top of
this data we add the Ethernet header. Typical header sizes are 14 bytes for Ethernet
(add another 4 bytes if you use 802.1Q tagging).
Below is a picture with the different MTU fields that you might encounter:
9|Page
You can see that a typical Ethernet header is 14 bytes, IP is 20 bytes and TCP is also 20
bytes. The maximum amount of payload that TCP can use is called the TCP MSS
(Maximum Segment Size). This MSS value is the largest amount of data that a host
can receive in a single TCP segment. This value is used to set a limit on the payload in
order to prevent fragmentation and is sent in the SYN packet during the 3-way
handshake. The MSS value isn’t synchronized between hosts, it can be different for
each direction.
So why is all of this important to know? Let’s imagine we have an IP packet that is sent
on our LAN. The size of the Ethernet frame will be like this:
1460 bytes of payload for TCP.
20 bytes for the TCP header.
20 bytes for the IP header.
14 bytes for the Ethernet header.
1460 (PAYLOAD) + 20 (TCP) + 20 (IP) = 1500 bytes + 14 (ETHERNET) = 1514 bytes in
total.
Sending 1514 bytes is no problem for Ethernet but some other mediums might have
issues with large MTU values. Often problems arise when you add additional
headers because of PPPoE, GRE Tunneling or IPSEC since this reduces the available
bytes for our MTU. To demonstrate this problem (and how to solve it!) I will use a simple
network with a reduced MTU. Here’s what it looks like:
The network above has two routers, a webserver (S1) behind R1 and a client (H1)
behind R2. Here’s what the configuration looks like:
10 | P a g e
1. Configuration
First, we’ll configure some IP addresses:
The first MTU value is the interface MTU, it’s 1500 bytes by default for Ethernet. The
second one is the IP MTU which is also 1500 bytes. Once you get above 1500 bytes
your router will start fragmenting the IP packets.
Is this limit of 1500 bytes really working? There’s an easy way to find out. Let’s do a ping
with the DF-bit (Don’t Fragment) between the routers:
R2#ping
Protocol [ip]:
Target IP address: 192.168.12.1
Repeat count [5]: 1
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]: y
Validate reply data? [no]:
Data pattern [0xABCD]:
11 | P a g e
Loose, Strict, Record, Timestamp, Verbose[none]: v
Loose, Strict, Record, Timestamp, Verbose[V]:
Sweep range of sizes [n]: y
Sweep min size [36]: 1495
Sweep max size [18024]: 1505
Sweep interval [1]:
Type escape sequence to abort.
Sending 11, [1495..1505]-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
Packet sent with the DF bit set
Reply to request 0 (1 ms) (size 1495)
Reply to request 1 (4 ms) (size 1496)
Reply to request 2 (1 ms) (size 1497)
Reply to request 3 (4 ms) (size 1498)
Reply to request 4 (1 ms) (size 1499)
Reply to request 5 (4 ms) (size 1500)
Request 6 timed out (size 1501)
Request 7 timed out (size 1502)
Request 8 timed out (size 1503)
Request 9 timed out (size 1504)
Request 10 timed out (size 1505)
Success rate is 54 percent (6/11), round-trip min/avg/max = 1/2/4 ms
In the ping above you can see that the largest packet that I can send is 1500 bytes. The
second packet with 1501 bytes can’t be sent because it is too large, and we set the DF-
bit.
Let’s look at an actual packet between the client and the webserver, see what these
values look like in an actual frame:
Above you can see the TCP MSS which is 1460 bytes. What else can we see in
Wireshark?
12 | P a g e
Above you see that the total length of the IP packet is 1500 bytes (1460 bytes for TCP
MSS + 40 bytes for the TCP/IP header). Ethernet adds another 14 bytes which is how
we get to 1514 bytes in total.
To simulate a network with a lower MTU I will reduce the MTU of the FastEthernet 0/0
interface of R2:
By reducing the MTU to 1400 bytes, the largest TCP segment size will be only 1360
bytes (1400 – 40 = 1360). This is a scenario where users often complain that sending a
ping is no problem but accessing a website or something else doesn’t work. Why? Let’s
look at the example below:
Above you see a ping between the client and webserver. As you can see the total length
is only 74 bytes…no problem to send this because our MTU allows 1400 bytes. Now we
will try to connect to the webserver from the client using HTTP:
This is where things go wrong…as you can see above the total length of the IP Packet is
1500 bytes which is 100 bytes above our MTU of 1400 bytes. It’s impossible to
communicate between the client and webserver now.
13 | P a g e
How do we fix this? There are two solutions for this:
Set the correct IP MTU value so the router knows when to fragment IP packets.
Reduce the TCP MSS value for outgoing connections so there is less payload.
Here’s how to configure the correct IP MTU value:
This tells the router to fragment all outgoing IP packets when they exceed 1400 bytes.
The second step is to tell the router to intercept all TCP SYN packets from hosts and
change the MSS value. We do this on the interface that is facing our hosts:
Setting the TCP MSS value to 1360 ensures that our total MTU will be 1400 bytes (1360
+ 40). Does this work? Let’s look at a Wireshark example between our host and
webserver again:
Above you can see that the maximum segment size is now 1360 bytes. What about the
total packet length? Look below…
14 | P a g e
With a TCP MSS of 1360 our IP packet is only 1400 bytes which is exactly our MTU of
1400 bytes. You will notice that all communication problems between the host and
webserver are now solved.
The IP tcp adjust-mss command is to intercept TCP SYN packets from hosts and set the
correct MSS value, if you want to change the MSS for TCP connections that are
originated by the router you need to use another command:
The ip tcp mss command changes the MSS for the router itself. We can do a debug to
check if it’s working or not:
R2#telnet 192.168.1.1 80
Trying 192.168.1.1, 80 ... Open
TCB495B8B94 created
TCB495B8B94 setting property TCP_VRFTABLEID (20) 496CF85C
TCB495B8B94 setting property TCP_TOS (11) 496CF7F8
TCB495B8B94 setting property TCP_RTRANSTMO (31) 496CF728
TCB495B8B94 setting property TCP_GIVEUP (34) 496CF72C
TCP: Random local port generated 36352, network 1
TCB495B8B94 bound to UNKNOWN.36352
TCB495B8B94 setting property unknown (24) 496CF758
Reserved port 36352 in Transport Port Agent for TCP IP type 1
TCP: sending SYN, seq 3882550463, ack 0
TCP0: Connection to 192.168.1.1:80, advertising MSS 1360
TCP0: state was CLOSED -> SYNSENT [36352 -> 192.168.1.1(80)]
TCP0: state was SYNSENT -> ESTAB [36352 -> 192.168.1.1(80)]
TCP: tcb 495B8B94 connection to 192.168.1.1:80, peer MSS 1460, MSS is 1360
You can see that R2 is using a MSS value of 1360 now…problem solved.
15 | P a g e
1.1.b: Layer 2 Protocols
Let’s talk a bit about network management. Perhaps not the most exciting topic but I’m
going to show you how you can use CDP (Cisco Discovery Protocol) to help you build
network maps and what other information it can reveal.
Most networks have multiple switches and/or routers and to make our life easier it’s
good to have a network map that shows us how everything is connected to each other,
what kind of devices we have, to what VLAN they belong and the IP addresses that we
are using. CDP is a Cisco protocol that runs on all Cisco devices that helps us discover
Cisco devices on the network. CDP is Cisco proprietary, runs on the data-link layer and
is enabled by default.
Let’s take a look at a network map:
Above we have 3 routers. Now if I had no idea what the network looked like we could
use CDP to build the network map that you see above. Let me show you how:
16 | P a g e
R2 Ser 0/0 167 R S I 3640 Ser 0/0
Now we have all the information we need to build a network map with the router names
and interfaces. CDP can tell us even more however…
Version :
Cisco IOS Software, 3600 Software (C3640-JK9O3S-M), Version 12.4(16), RELEASE
SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 20-Jun-07 11:43 by prod_rel_team
advertisement version: 2
VTP Management Domain: ''
Use show cdp neighbors detail to reveal even more information. For example, you can
see the IP address and the IOS version. This can be very useful to us but it’s also a
security risk. By default, CDP is enabled and runs on all interfaces so it might be a good
idea to disable it on certain interfaces:
17 | P a g e
This is how you can disable it for a single interface, just type no cdp enable. This is how
you can do it globally for all interfaces:
That’s all there is to CDP. Besides revealing networking information CDP is also used for
Cisco IP phones but that’s another story. Keep in mind CDP only runs on Cisco
hardware, there’s also a “standards” based version called LLDP that runs on Cisco
hardware and some other networking vendor equipment.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
interface Serial0/0
ip address 192.168.12.1 255.255.255.0
no cdp enable
!
no cdp run
!
end
hostname R2
!
interface Serial0/0
ip address 192.168.12.2 255.255.255.0
!
interface FastEthernet1/0
ip address 192.168.23.2 255.255.255.0
!
end
hostname R3
!
interface FastEthernet1/0
ip address 192.168.23.3 255.255.255.0
!
end
LLDP is a layer two discovery protocol, similar to Cisco’s CDP. The big difference
between the two is that LLDP is a standard while CDP is a Cisco proprietary protocol.
Cisco devices support the IEEE 802.1ab version of LLDP. This allows non-Cisco devices
to advertise information about themselves to our network devices.
LLDP uses attributes that contain a type, length and value descriptions. These are called
TLVs (Type, Length, Value). Devices that support LLDP use TLVs to send and receive
18 | P a g e
information to their directly connected neighbors. Here’s an example of some basic
TLVs:
Port description TLV
System name TLV
System description TLV
System capabilities TLV
Management Address TLV
Some network end devices (like IP Phones) can use LLDP for VLAN assignment or PoE
(Power over Ethernet) requirements. To accomplish this, an enhancement was made
which is called MED (Media Endpoint Discovery). This is typically known as LLDP-MED.
Configuration of LLDP is really simple, depending on your switch and IOS version it
might be enabled or disabled by default. Let’s take a look at an example
I have two Cisco Catalyst 3560 switches, directly connected to each other. LLDP is
disabled by default on these switches so let’s enable it:
SW1, SW2
(config)#lldp run
This enables LLDP globally on all interfaces. After a couple of seconds we can see
something:
Capability codes:
(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other
This output looks very similar to CDP. We can also take a detailed look at our neighbor:
19 | P a g e
Port Description: FastEthernet0/24
System Name: SW2.cisco.com
System Description:
Cisco IOS Software, C3560 Software (C3560-ADVIPSERVICESK9-M), Version 12.2(46)SE,
RELEASE SOFTWARE (fc2)
Copyright (c) 1986-2008 by Cisco Systems, Inc.
Compiled Thu 21-Aug-08 15:26 by nachen
Above you can see some details about SW2, it’s hostname, platform, IOS version,
capabilities etc. One little extra that LLDP offers is that it also sends interface
descriptions. Here’s an example:
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname SW1
!
interface FastEthernet 0/24
description LINK_SW1_SW2
!
lldp run
!
20 | P a g e
end
hostname SW2
!
lldp run
!
end
Introduction to VLANs
In this lesson we will take a look at VLANs (Virtual LANs) and I will explain what they are
and why we need them.
First of all, let me show you a picture of a network:
21 | P a g e
Look at this picture for a minute, we have many departments and every department has
its own switch. Users are grouped physically together and are connected to their switch.
what do you think of it? Does this look like a good network design? If you are unsure let
me ask you some questions to think about:
What happens when a computer connected to the Research switch sends a
broadcast like an ARP request?
What happens when the Helpdesk switch fails?
Will our users at the Human Resource switch have fast network connectivity?
How can we implement security in this network?
Now let me explain to you why this is a bad network design. If any of our computers
sends a broadcast what will our switches do? They flood it! This means that a single
broadcast frame will be flooded on this entire network. This also happens when a switch
hasn’t learned about a certain MAC address, the frame will be flooded.
If our helpdesk switch would fail this means that users from Human Resource are
“isolated” from the rest and unable to access other departments or the internet, this
applies to other switches as well. Everyone has to go through the Helpdesk switch in
order to reach the Internet which means we are sharing bandwidth, probably not a very
good idea performance-wise.
Last but not least, what about security? We could implement port-security and filter on
MAC addresses but that’s not a very secure method since MAC addresses are very
easy to spoof. VLANs are one way to solve our problems.
One more question I’d like to ask you to refresh your knowledge:
How many broadcast domains do we have here?
What about broadcast domains? We didn’t talk about this before, but I think you can
answer it. If a computer from the sales switch would send a broadcast frame, we know
22 | P a g e
that all other switches will forward it. Did you spot the router on top of the picture? What
about it…do you think a router will forward a broadcast frame?
The answer is that routers don’t forward broadcast frames so they effectively “limit” our
broadcast domain. Of course, on the right side of our router where we have an Internet
connection this would be another broadcast domain…so we have 2 broadcast domains
here. Let’s see how we can improve things…
When you work with switches you have to keep in mind there’s a big difference between
physical and logical topology. Physical is just the way our cables are connected while
logical is how we have setup things ‘virtually’. In the example above we have 4 switches
and I have created 3 VLANs called Research, Engineering and Sales. A VLAN is a
Virtual LAN so it’s like having a “switch inside a switch”.
What are the advantages of using VLANs?
A VLAN is a single broadcast domain which means that if a user in the research
VLAN would send a broadcast frame only users in the same VLAN will receive it.
Users are only able to communicate within the same VLAN unless you use a
router.
Users don’t have to be grouped physically together, as you can see, we have
users in the Engineering VLAN sitting on the 1 st, 2nd and 3rd floor.
That’s all for now. I hope this has given you an idea of what VLANs are and why we use
them! If you enjoyed this lesson, please leave a comment.
In this lesson I will show you how to configure VLANs on Cisco Catalyst Switches
and how to assign interfaces to certain VLANs. Let’s start with a simple network
topology:
23 | P a g e
Let’s start with a simple example. H1 and H2 are connected to SW1.
First, we will look at the default VLAN configuration on SW1:
SW1#show vlan
Interesting…VLAN 1 is the default LAN and you can see that all active interfaces are
assigned to VLAN 1.
VLAN information is not saved in the running-config or startup-config but in a separate
file called vlan.dat on your flash memory. If you want to delete the VLAN information you
should delete this file by typing delete flash:vlan.dat. I configured an IP address on
H1 and H2 so they are in the same subnet.
Let’s see if H1 and H2 can reach each other:
24 | P a g e
Even with the default switch configuration H1 is able to reach H2. Let’s see if I can
create a new VLAN for H1 and H2:
SW1(config)#vlan 50
SW1(config-vlan)#name Computers
SW1(config-vlan)#exit
This is how you create a new VLAN. If you want, you can give it a name, but this is
optional. I’m calling my VLAN “Computers”.
SW1#show vlan
VLAN 50 was created on SW1 and you can see that it’s active. However, no ports are
currently in VLAN 50. Let’s see if we can change this…
SW1(config)interface fa0/1
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 50
SW1(config)interface fa0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 50
First, I will configure the switchport in access mode with the switchport mode access
command. By using the switchport access vlan command we can move our interfaces
to another VLAN.
SW1#show vlan
25 | P a g e
50 Computers active Fa0/1, Fa0/2
Excellent! Both computers are now in VLAN 50. Let’s verify our configuration by
checking if they can ping each other:
Our computers are able to reach each other within VLAN 50. Besides pinging each other
we can also use another show command to verify our configuration:
By using the “show interfaces switchport” command we can see that the operational
mode is “static access” which means it’s in access mode. We can also verify that the
interface is assigned to VLAN 50.
26 | P a g e
Want to take a look for yourself? Here you will find the final configuration of the switch.
hostname SW1
!
vlan 50
name Computers
!
interface FastEthernet0/1
switchport mode access
switchport access vlan 50
!
interface FastEthernet0/2
switchport mode access
switchport access vlan 50
!
End
When you want VLAN traffic between two switches then there is one problem we run
into…take a look at the image below:
This is a normal Ethernet frame…do you see any field where we can specify to which
VLAN our Ethernet frame belongs? Well there isn’t! So how does a switch know to what
VLAN something belongs when it receives a frame? It has no clue so that’s why we
need another protocol to help us.
If you want to VLAN traffic between switches we have to use a trunk. A trunk connection
is simply said nothing more but a normal link, but it is able to pass traffic from different
VLANs and has a method to separate traffic between VLANs. Here’s an example:
27 | P a g e
As you can see, we have computers on both sides and they are in different VLANs, by
using trunks we can make sure all VLAN traffic can be sent between the switches.
Because our regular Ethernet frames don’t have anything to show to which VLAN they
belong we will need another protocol.
There are two trunking protocols:
802.1Q: This is the most common trunking protocol. It’s a standard and
supported by many vendors.
ISL: This is the Cisco trunking protocol. Not all switches support it.
Let’s take a look at 802.1Q:
Here’s an example of an 802.1Q Ethernet frame. As you can see it’s the same as a
normal Ethernet frame, but we have added a tag in the middle (that’s the blue field). In
our tag you will find a “VLAN identifier” which is the VLAN to which this Ethernet frame
belongs. This is how switches know to which VLAN our traffic belongs.
There’s also a field called “Priority” which is how we can give a different priority to the
different types of traffic. This is useful when you have one VLAN for voice over IP traffic
and another VLAN for data traffic, you probably want to give the VoIP traffic priority, or
your call quality might suffer.
The IEEE 802.1Q trunking protocol describes something called the native VLAN.
All native VLAN traffic is untagged; it doesn’t have an 802.1Q tag on the Ethernet
frame. When you look at it in Wireshark, it will look the same, just like any standard
Ethernet frame.
When your Cisco switches receive an Ethernet frame without a tag on an 802.1Q
enabled interface, it will assume that it belongs to the native VLAN. For this reason, you
need to make sure that the native VLAN is the same on both sides.
By default, VLAN 1 is the native VLAN. We can change this if we want. Let’s look at an
example. I will use two switches for this:
28 | P a g e
I will configure an 802.1Q trunk between those two switches so we can look at the native
VLAN:
We can verify our trunk configuration and see the native VLAN like this:
Above, you can see that the trunk is operational, we are using 802.1Q encapsulation,
and the native VLAN is 1. So, what kind of traffic is running on the native VLAN? Let’s
take a look at a Wireshark capture of our trunk!
29 | P a g e
As you can see, some of the management protocols like CDP (Cisco Discovery
Protocol) are sent on the native VLAN. For security reasons, it might be a good idea to
change the native VLAN from VLAN 1 to something else. You can do it like this:
Instead of VLAN 1, we will now use VLAN 10 as the native VLAN. Let’s verify our work:
There we go, VLAN 10 is now the native VLAN. Last but not least, we can also configure
our switches to tag the native VLAN just like any other VLAN. Here’s how to do it:
30 | P a g e
That’s all there is to it! Hopefully, this lesson has been helpful to you to understand the
native VLAN and how to configure it.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname SW1
!
interface Fastethernet 0/24
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk native vlan 10
!
vlan dot1q tag native
!
end
hostname SW2
!
interface Fastethernet 0/24
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk native vlan 10
!
vlan dot1q tag native
!
end
802.1Q tunneling (aka Q-in-Q) is a technique often used by Metro Ethernet providers as
a layer 2 VPN for customers. 802.1Q (or dot1q) tunneling is pretty simple…the provider
will put an 802.1Q tag on all the frames that it receives from a customer with a unique
VLAN tag. By using a different VLAN tag for each customer we can separate the traffic
from different customers and also transparently transfer it throughout the service
provider network.
One of the advantages of this solution is that it’s easy to implement, you don’t need
exotic hardware and we don’t have to run any routing protocols between the service
provider and customer (unlike MPLS VPN). From the customer’s perspective, it’s just
like their sites are directly connected on layer 2.
In this lesson, I’m going to show you how to configure 802.1Q tunneling and I’ll explain
how it works. I’ll be using the following topology for this:
31 | P a g e
Above you see two routers called R1 and R2, imagine these routers are the customer
sites that we want to connect through the service provider network which consists of
SW1, SW2 and SW3. Our customer wants to use VLAN 12 between the two sites and
expects our service provider to transport this from one site to another.
In my example our customer will be using VLAN 12 for traffic between their sites. The
service provider has decided to use VLAN 123 to transport everything for this customer.
Basically, this is what will happen when we send frames between R1 and R2:
Whenever R1 sends traffic it will tag its frames for VLAN 12. Once it arrives at the
service provider, SW1 will add an additional VLAN tag (123). Once SW2 forwards the
frame towards R2 it will remove the second VLAN tag and forwards the original tagged
frame from R1.
Here is another way to visualize this:
32 | P a g e
Here’s what the router configs look like:
R1 and R2 are both configured with sub-interfaces and use subnet 192.168.12.0 /24. All
their frames are tagged as VLAN 12.
On the service provider network we’ll have to configure a number of items. First, I will
configure 802.1Q trunks between SW1 – SW3 and SW2 – SW3:
The next part is where we configure the actual “Q-in-Q” tunneling. The service provider
will use VLAN 123 to transfer everything from our customer. We’ll configure the
interfaces towards the customer routers to tag everything for VLAN 123:
33 | P a g e
interfaces above to this VLAN it was automatically created on SW1 and SW2, but I also
have to make sure that SW3 has VLAN 123 in its database:
SW3(config)#vlan 123
Everything is now in place, let’s do a quick test to see if R1 and R2 can reach each
other:
R1#ping 192.168.12.2
Great! Our ping is working! Let’s take a look at some commands to verify our work:
SW1#show dot1q-tunnel
34 | P a g e
Port Mode Encapsulation Status Native vlan
Fa0/21 on 802.1q trunking 1
As you can see above the only VLAN that is active (besides VLAN 1) on these trunk
links is VLAN 123. You won’t see VLAN 12 here because that’s the customer traffic and
it’s encapsulated with VLAN 123. Another good way to prove this is by looking at
spanning-tree:
Our switches don’t have a spanning-tree topology for VLAN 12, they don’t care what
VLAN the customer is using…they only care about VLAN 123.
So far so good! 802.1Q tunneling has some more tricks up its sleeve, one of the things it
can do is tunnel some layer 2 protocols. Take a look below:
35 | P a g e
SW1(config-if)#l2protocol-tunnel ?
cdp Cisco Discovery Protocol
drop-threshold Set drop threshold for protocol packets
point-to-point point-to-point L2 Protocol
shutdown-threshold Set shutdown threshold for protocol packets
stp Spanning Tree Protocol
vtp Vlan Trunking Protocol
<cr>
If you want it can tunnel CDP, VTP, STP and even point-to-point protocols like PAgP or
LACP (Etherchannel). Let me show you what happens when you tunnel CDP traffic:
I’ll tell SW1 and Sw2 to tunnel all CDP traffic between the interfaces that are connected
to R1 and R2. Take a look below for the result:
By tunneling CDP packets between R1 and R2 they see each other as directly
connected. That’s a great example of a “transparent” network. Here’s what it looks like in
wireshark:
The last thing we have to discuss are MTU (Maximum Transmission Unit) problems.
36 | P a g e
The ethernet frame of the customer with the 802.1Q tag will have a MTU of 1500 bytes
but since we are adding another 802.1Q tag the total MTU will be 1504 bytes in the
service provider network. By default, most switches will only allow a maximum MTU of
1500 bytes so you will run into problems with large packets. Below you can see the
actual problem:
Because of second tag this ping will be dropped because the MTU is too small. To solve
this, you should increase the maximum MTU size of your switches:
After configuring the MTU you have to reboot your switches. You can see the MTU size
like this:
There we go, problem solved! Here’s what this ping looks like in wireshark:
37 | P a g e
This is all I have for now on 802.1Q tunneling, I hope this has been helpful to you. If you
have any questions, feel free to leave a comment!
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
interface FastEthernet0/0.12
encapsulation dot1Q 12
ip address 192.168.12.1 255.255.255.0
!
end
hostname R2
!
interface FastEthernet0/1.12
encapsulation dot1Q 12
ip address 192.168.12.2 255.255.255.0
!
end
hostname SW1
!
vlan 123
!
interface FastEthernet0/1
switchport access vlan 123
switchport mode dot1q-tunnel
l2protocol-tunnel cdp
no cdp enable
!
interface FastEthernet0/19
switchport trunk encapsulation dot1q
switchport mode trunk
!
end
hostname SW2
!
vlan 123
!
interface FastEthernet0/2
switchport access vlan 123
switchport mode dot1q-tunnel
l2protocol-tunnel cdp
no cdp enable
!
interface FastEthernet0/21
switchport trunk encapsulation dot1q
switchport mode trunk
!
end
38 | P a g e
hostname SW3
!
vlan 123
!
interface FastEthernet1/0/19
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet1/0/21
switchport trunk encapsulation dot1q
switchport mode trunk
!
end
Let’s say you have a network with 20 switches and 50 VLANs. Normally you would have
to configure each switch separately and create those VLANs on each and every switch.
That’s a time-consuming task so there is something to help us called VTP (VLAN
Trunking Protocol). VTP will let you create VLANs on one switch and all the other
switches will synchronize themselves.
We have one VTP server which is the switch where you create / modify or delete
VLANs. The other switches are VTP clients. The VTP configuration has a revision
number which will increase when you make a change. Every time you make a change
on the VTP server this will be synchronized to the VTP clients. Oh, and by the way you
can have multiple VTP servers since it also functions as a VTP client so you can make
changes on multiple switches in your network. In order to make VTP work you need to
setup a VTP domain name which is something you can just make up, as long as you
configure it to be the same on all your switches.
This is the short version of what I just described:
1. VTP adds / modifies / deletes VLANs.
2. For every change the revision number will increase.
3. The latest advertisement will be sent to all VTP clients.
4. VTP clients will synchronize themselves with the latest information.
Besides the VTP server and VTP client there’s also a VTP transparent which is a bit
different, let me show you an example:
39 | P a g e
Our VTP Transparent will forward advertisements but will not synchronize itself. You
can create VLANs locally though which is impossible on the VTP client. Let’s say you
create VLAN 20 on our VTP server, this is what will happen:
1. You create VLAN 20 on the VTP server.
2. The revision number will increase.
3. The VTP server will forward the latest advertisement which will reach the VTP
transparent switch.
4. The VTP transparent will not synchronize itself but will forward the advertisement
to the VTP client.
5. The VTP client will synchronize itself with the latest information.
Here’s an overview of the 3 VTP modes:
Should you use VTP? It might sound useful but VTP has a big security risk…the problem
with VTP is that a VTP server is also a VTP Client and any VTP client will synchronize
itself with the highest revision number. The following situation can happen with VTP:
You have a network with a single VTP server and a couple of VTP client switches,
everything is working fine but one day you want to test some stuff and decide to take
one of the VTP clients out of the network and put it in a lab environment.
40 | P a g e
You take the VTP client switch out of the network.
1. You configure it so it’s no longer a VTP Client but a VTP server.
2. You play around with VTP, create some VLANs, modify some.
3. Every time you make a change the revision number increases.
4. You are done playing…you delete all VLANs.
5. You configure the switch from VTP Server to VTP Client.
6. You connect your switch to your production network.
What do you think the result will be? The revision number of VTP on the switch we
played with is higher than the revision number on the switches of our production
network. The VTP client will advertise its information to the other switches, they
synchronize to the latest information and POOF all your VLANs are gone! A VTP client
can overwrite a VTP server if the revision number is higher because a VTP server is
also a VTP client.
Yes, I know this sounds silly but this is the way it works…very dangerous since you’ll
lose all your VLAN information. Your interfaces won’t go back to VLAN 1 by default but
will float around in no man’s land…
One more thing about VTP, let me give you another picture:
You see we have computers in VLAN 10, 20 and 30. The links between the switches are
trunks using the 802.1Q protocol and carrying all VLAN traffic. One of our computers in
VLAN 10 sends a broadcast frame, where do you think this broadcast frame will go?
Broadcast frames have to be flooded by our switches and since our trunks are carrying
all VLANs, this broadcast will go everywhere. However, if you look at the switch in the
middle do you see any computer in VLAN 10? Nope there’s only VLAN 20 there which
means this broadcast is wasted bandwidth. By enabling VTP pruning we’ll make sure
there is no unnecessary VLAN traffic on trunks when there’s nobody in a particular
VLAN. Depending on your switch model VTP pruning is either turned on or off by default.
Let’s take a look at the configuration of VTP. I will be using three switches for this task. I
erased the VLAN database and the startup-configuration on all switches.
41 | P a g e
SW1#show vtp status
VTP Version : running VTP1 (VTP2 capable)
Configuration Revision : 0
Maximum VLANs supported locally : 1005
Number of existing VLANs : 5
VTP Operating Mode : Server
VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Local updater ID is 0.0.0.0 (no valid interface found)
42 | P a g e
SW3#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 1005
Number of existing VLANs : 5
VTP Operating Mode : Server
VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Local updater ID is 0.0.0.0 (no valid interface found)
Depending on the switch model you will see a similar output if you use the show vtp
status command. There’s a couple of interesting things to see here:
Configuration revision 0: Each time we add or remove VLANs this number will
change. It’s 0 at the moment since I haven’t created or removed any VLANs.
VTP Operating mode: the default is VTP server.
VTP Pruning: this will help to prevent unnecessary traffic on your trunk links,
more in this later.
VTP V2 Mode: The switch is capable of running VTP version 2 but it’s currently
running VTP version 1.
SW1(config)#vlan 10
SW1(config-vlan)#name Printers
SW1#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/22
Fa0/23, Fa0/24, Gi0/1, Gi0/2
10 Printers active
43 | P a g e
SW1#show vtp status
VTP Version : running VTP1 (VTP2 capable)
Configuration Revision : 1
You can see that the configuration revision has increased by one.
Unfortunately, nothing has changed on SW2 and SW3. This is because we need to
configure a VTP domain-name before it starts working.
You will see the following debug information on SW2 and SW3; there are two interesting
things we can see here:
The switch receives a VTP packet from domain “NETWORKLESSONS” and
decides to change its own domain-name from “NULL” (nothing) to
“NETWORKLESSONS”. It will only change the domain-name if it doesn’t have a
domain-name.
The switch sees that the VTP packet has a higher revision number (1) than what
it currently has (0) and as a result it will synchronize itself.
44 | P a g e
All possible debugging has been turned off
Make sure to disable the debug output before you get flooded with information.
SW2#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15,
Fa0/23, Fa0/24, Gi0/1, Gi0/2
10 Printers active
SW3#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/20, Fa0/22, Fa0/23,
Gi0/1, Gi0/2
10 Printers active
The show vlan command tells us that SW2 and SW3 have learned VLAN 10 through
VTP.
Since all switches are in VTP Server mode I can create VLANs on any switch and they
should all synchronize:
SW2(config)#vlan 20
SW2(config-vlan)#name Servers
SW3(config)#vlan 30
45 | P a g e
SW3(config-vlan)#name Management
SW1#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
SW2#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
SW3#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
As you can see all switches know about the VLANs. What about the revision number?
Did it change?
Each time I create another VLAN the revision number increases by one. Let’s change
the VTP mode on SW2 to see what it does.
46 | P a g e
SW2(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW1(config)#vlan 40
SW1(config-vlan)#name Engineering
SW2#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
40 Engineering active
SW3 learns about VLAN 40 through SW2. SW2 as a VTP client will synchronize itself
but it will also forward VTP advertisements.
SW2(config)#vlan 50
%VTP VLAN configuration not allowed when device is in CLIENT mode.
47 | P a g e
A switch running in VTP Client mode is unable to create VLANs so that’s why I get this
error if I try to create one.
What about the VTP Transparent mode? That’s the last one we have to try…
I’ll change SW2 to VTP Transparent mode and the link between SW1 and SW3 is still
disconnected.
SW1(config)#vlan 50
SW1(config-vlan)#name Research
SW1#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
40 Engineering active
50 Research active
SW2#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
40 Engineering active
It doesn’t show up on SW2 because it’s in VTP transparent mode and doesn’t
synchronize itself.
SW3#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
40 Engineering active
48 | P a g e
50 Research active
SW2(config)#vlan 60
SW2(config-vlan)#name Cameras
SW2#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
40 Engineering active
50 Research active
60 Cameras active
We can create this new VLAN on SW2 without any trouble. It’s in VTP Transparent
mode so we can do this.
SW1#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
40 Engineering active
50 Research active
SW3#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
10 Printers active
20 Servers active
30 Management active
40 Engineering active
50 Research active
VLAN 60 doesn’t show up on SW1 and SW3 because SW2 is in VTP Transparent mode.
SW2 will not advertise its VLANs because they are only known locally.
Is there anything else you need to know about VTP Transparent mode?
SW2#show running-config
Building configuration...
vlan 10
49 | P a g e
name Printers
!
vlan 20
name Servers
!
vlan 30
name Management
!
vlan 40
name Engineering
!
vlan 60
name Cameras
There’s a difference between VTP Transparent mode VS Server/Client mode. If you look
at the running-config you will see that VTP Transparent stores all VLAN information in
the running-config. VTP Server and Client mode store their information in the VLAN
database (vlan.dat on your flash memory).
VTP Version 3
In an earlier lesson I explained the basics of VTP (version 1 and 2). The main goal of
VTP version 3 remains to synchronize VLANs but it has a number for extras. It’s been
around for a while but until recent IOS versions it wasn’t supported on Cisco Catalyst
Switches.
Here are some of the new additions to VTP version 3:
VTP primary server: only the primary server is able to create / modify / delete
VLANs. This is a great change as you can no longer “accidently” wipe all VLANs
like you could with VTP version 1 or 2.
Extended VLANs: you can now synchronize VLANs in the extended VLAN range
(1006 – 4094).
Private VLANs: if you have VLANs that are configured as private VLANs then
you can synchronize them with VTPv3.
RSPAN VLANs: remote SPAN VLANs can now be synchronized.
MST Support: one of the problems of MST is that you had to configure each
switch manually. With VTPv3, MST configurations are synchronized.
Authentication improvements: VTPv3 has more secure methods for
authentication.
VTP mode off: If you didn’t want to use VTP for version 1 or 2 then you had to
use the transparent mode. VTPv3 can be disabled globally or per interface.
Compatibility: VTP version 3 is compatible with version 2, not version 1.
I’ll walk you through each of those and show you how to configure VTP version 3. I’ll use
the following topology:
50 | P a g e
All interfaces between the switches are configured as trunks.
1. Configuration
1.1. Basic Configuration
First, we will try to enable VTP version 3 on one of our switches:
SW1(config)#vtp version 3
Cannot set the version to 3 because domain name is not configured
The domain name is now a requirement, it can’t be null. Let’s set one and try again:
SW1(config)#vtp version 3
Being VTP server however is not enough to make changes to the VLAN database, take
a look below:
SW1(config)#vlan 100
VTP VLAN configuration not allowed when device is not the primary server for vlan
database.
51 | P a g e
This is new, one of the switches has to be the primary server in order to create /
modify or delete VLANs. Let’s make SW1 our primary server:
SW1#vtp primary
This system is becoming primary server for feature vlan
No conflicting VTP3 devices found.
Do you want to continue? [confirm]
As soon as I make SW1 the primary server then you’ll also see this message on the
other switches:
SW1 is now the primary server. We can verify this from SW1 or any other switch in our
VTP domain:
SW2 and SW3 are able to confirm that SW1 is the primary server. VTP version 3 also
has a new command that allows us to see all switches in the same VTP domain:
You can run this command on any of your switches, it will show all VTP members (not
just the directly connected ones like CDP does).
52 | P a g e
Let’s see if we are able to synchronize some VLANs. We’ll start with something simple:
SW1(config)#vlan 100
SW1(config-vlan)#exit
There it is! We can also synchronize VLANs in the extended range (1006 – 4094). Let’s
give it a try:
SW1(config)#vlan 1234
SW1(config-vlan)#exit
SW1(config)#vlan 502
SW1(config-vlan)#private-vlan isolated
SW1(config)#vlan 500
SW1(config-vlan)#private-vlan primary
SW1(config-vlan)#private-vlan association add 501
SW1(config-vlan)#private-vlan association add 502
We’ll create VLAN 500 with two VLANs. VLAN 501 is a community VLAN and VLAN 502
is an isolated VLAN. Let’s see if it shows up on SW1:
53 | P a g e
Primary Secondary Type Ports
------- --------- ----------------- ------------------------------------------
500 502 isolated
501 community
We see the exact same thing on SW2 and SW3. This is a nice addition to VTPv3.
SW1(config)#vlan 600
SW1(config-vlan)#remote-span
SW1(config-vlan)#exit
54 | P a g e
SW1#show vtp status
VTP Version capable : 1 to 3
VTP version running : 3
VTP Domain Name : NWL
VTP Pruning Mode : Disabled
VTP Traps Generation : Disabled
Device ID : 0019.569d.5700
Feature VLAN:
--------------
VTP Operating Mode : Primary Server
Number of existing VLANs : 12
Number of existing extended VLANs : 1
Configuration Revision : 7
Primary ID : 0019.569d.5700
Primary Description : SW1
MD5 digest : 0xC9 0x25 0xB3 0x86 0xE7 0xA1 0xE3 0xAE
0xF8 0x2F 0xB9 0x7F 0x64 0xB3 0x43 0x5F
Feature MST:
--------------
VTP Operating Mode : Transparent
Feature UNKNOWN:
--------------
VTP Operating Mode : Transparent
The default “VLAN” feature is used for the things we did before…VLANs, extended
range VLANs, private VLANs and RSPAN. To synchronize MST information, we have to
use the “MST” feature. As you can see the VTP mode for this feature is currently
transparent.
Just like the VLAN feature, we require a primary server that will create the MST
configuration. You can use the same switch for this role, or you can pick another one. To
demonstrate this, I’ll make SW2 my primary server:
First, I change SW2 from transparent to server mode. Now we can set it to primary:
55 | P a g e
This message will also show up on SW1 and SW3:
You can see that this switch is now the primary server for the MST feature. Let’s make
SW1 and SW3 our clients:
Everything is now in place so let’s create a configuration for MST. I’ll keep it simple:
Normally you’d have to copy and paste the above on all your switches. We are going to
synchronize it, first let’s enable MST on all switches:
56 | P a g e
Revision 1 Instances configured 3
It’s showing up on SW2, that makes sense since that’s where we created it. What about
SW1 and SW3?
They received the MST configuration from SW2. It’s even stored in the running
configuration:
Great, MST is working. Let’s look at some other things that VTP version 3 can do…
57 | P a g e
1.5. Feature Unknown
If you looked carefully at the output of show vtp status, then you might have noticed that
there were 3 features:
VLAN
MST
UNKNOWN
This “unknown” feature is a placeholder for upcoming features that VTPv3 might use
someday. Here’s the output of VTP status:
Right now, you can only use the transparent mode for this, server and client are not
supported. If you try to enable it then you’ll get an error:
We’ll just have to wait to see if VTPv3 will ever use a new feature…
1.6. Authentication
Authentication has slightly changed. Take a look below:
58 | P a g e
Setting device VTP password
The password is now set to “NWL”. You can’t extract this password in clear text from the
switch. Here’s how it shows up:
If you need to add another switch, then you could copy and paste the above secret like
this:
You can disable it for the different “features”. Here’s how to disable VTP for the VLAN
feature:
It is now disabled globally. You can also disable VTP on the interface level:
59 | P a g e
SW4(config)#vtp version 2
If you try this, make sure you disable the passwords on your VTPv3 switches. VTP
version 2 doesn’t support the new password mechanism:
To see what is going on between the switches you can enable the following debug:
SW4#
VTP LOG RUNTIME: Incoming packet version rcvd 3 unknown
Voice VLAN
In this lesson, we’ll take a look at the Voice VLAN and how it works.
Usually, IP phones sit next to a computer on the same desk. They require the same UTP
cables as computers and also use Ethernet. If we want to connect them to a switch, we
have two options.
You could connect the computer and IP phone using two different cables:
You need to install a new cable from the switchport to the IP phone.
You will lose a switchport for the IP phone.
To solve this, most IP phones (including Cisco) have a three-port switch inside of the IP
phone:
60 | P a g e
One port connects to the switch.
One port connects to the computer.
One (internal) port connects to the phone.
This allows us to connect the IP phone and computer like this:
You probably want to separate the data from the computer and IP phone. This is
something we can do with voice VLANs.
The Voice VLAN is also known as the Auxiliary VLAN (AUX VLAN)
The computer will be in a data VLAN, the IP phone will be in the voice VLAN. It will look
like this:
Behind the scenes, we have a trunk between our switch and IP phone. The port on the
IP phone that connects to the computer is an access port. The IP phone will forward all
traffic from the computer to the switch untagged, traffic from the IP phone itself will
be tagged. The only two VLANs that are allowed though, are the access and voice
VLAN.
1. Configuration
If you are familiar with the configuration of VLANs then configuring a voice VLAN is very
simple. Let’s configure a switchport where we use VLAN 100 for the computer and VLAN
101 for our IP phone.
First, we have to create the two VLANs:
SW1(config)#vlan 100
SW1(config-vlan)#name COMPUTER
SW1(config-vlan)#exit
SW1(config)#vlan 101
SW1(config-vlan)#name VOIP
SW1(config-vlan)#exit
61 | P a g e
Now we can configure the interface:
We configure the interface in access mode and use VLAN 100 for the computer.
The switchport voice vlan command tells the switch to use VLAN 101 as the voice
VLAN.
We configured the switch but how does the IP phone know which VLANs to use? Cisco
IP phones use CDP (Cisco Discovery Protocol) for this. The IP Phone will learn through
CDP which VLANs it should use. Other IP phones sometimes use LLDP (Link Layer
Discovery Protocol) for this.
2. Verification
Let’s verify our work. You have to use the show interfaces command for this:
Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Appliance trust: none
62 | P a g e
Above you can see that we are using VLAN 100 for the Computers and VLAN 101 for
the IP phones.
We can also take a look at the trunk status. Although this will show us that the interface
is not-trunking, it does tell us the two VLANs that are used:
Above we see that VLAN 100 and 101 are allowed on this interface. Although it shows
up as non-trunking, keep in mind that in reality, this is a trunk.
3. Conclusion
In this lesson you have learned how to configure the Voice VLAN and how to verify your
work. If you have any questions, feel free to leave a comment in our forum.
63 | P a g e
1.1.d: EtherChannel
Take a look at the picture above. I have two switches and two computers connected to
each switch. We use Gigabit Ethernet interfaces everywhere.
Now imagine that H1 sends 800 Mbit of traffic destined to H3 and H2 sends 600 Mbit of
traffic destined to H4. The link between the switches will be a bottleneck. We require 800
+ 600 = 1400 Mbit but we only have a 1000 Mbit link.
There are two solutions to this problem:
Replace the link in between the switches with something that has a higher
bandwidth, perhaps a 10-Gigabit link.
Add multiple links and bundle them into an EtherChannel.
Since this lesson is about EtherChannel, we’ll take a look at adding multiple links. Here’s
an example:
64 | P a g e
In the picture above I have added a couple of extra links. The problem with this setup is
that we have a loop between the switches so spanning-tree would block one out of two
links. EtherChannel solves this problem because it creates a single virtual link out of
these physical links:
Spanning tree sees this link as one logical link so there are no loops! EtherChannel will
do load balancing among the different links that we have and it takes care of
redundancy. Once one of the links fails it will keep working and use the links that we
have left.
Keep in mind that the physical links remain the limiting factor. A single traffic flow won’t
be able to exceed > 1000 Mbit (single Gigabit link). An Etherchannel is the equivalent of
adding more lanes to a highway. The bandwidth increases, but the speed limit doesn’t
change.
65 | P a g e
LACP (IEEE standard)
Manual
PAgP and LACP are negotiation protocols that dynamically configure an Etherchannel.
PAgP is a Cisco proprietary protocol so you can only use it between Cisco devices.
LACP is an IEEE standard which many vendors support.
It’s also possible to configure a static EtherChannel without these protocols doing the
negotiation of the link for you.
If you are going to create an EtherChannel you need to make sure that all interfaces
have the same configuration:
Duplex.
Speed.
Native and allowed VLANs.
Switchport mode (access or trunk).
Desirable Auto
Auto Yes No
PAgP and LACP will check if the configuration of the interfaces that you use is the same.
1. Configuration
Let’s see if we can configure an Etherchannel. We’ll try all three options but start with
PAgP.
1.1. PAgP
If you want to configure PAgP there are two options, you can choose from. The interface
can be configured as:
Desirable: The interface will actively ask the other side to become an
EtherChannel.
Auto: The interface will wait passively for the other side to ask to become an
EtherChannel.
Here’s a quick overview with the two PAgP configuration options and whether an
EtherChannel will form or not:
Let me show you an example of how to configure PAgP between two switches. I’ll use
SW1 and SW2 for this demonstration:
66 | P a g e
SW1 and SW2 each have two Gigabit interfaces which we’ll bundle these into a single
logical link.
Here are our options:
I configure SW1 for PAgP desirable mode. It will actively ask SW2 to become an
EtherChannel this way. We can configure SW2 in either auto or desirable mode. I’ll use
auto mode:
With auto mode, SW2 will only respond to incoming PAgP requests. After a few
seconds, you’ll see the following message on both switches:
67 | P a g e
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
12 packets input, 973 bytes, 0 no buffer
Received 0 broadcasts (0 multicasts)
0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 input packets with dribble condition detected
240 packets output, 17496 bytes, 0 underruns
0 output errors, 0 collisions, 0 interface resets
0 unknown protocol drops
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
interface Port-channel1
end
Our two physical interfaces that belong to this EtherChannel only have the channel-
group command:
interface GigabitEthernet0/1
channel-group 1 mode desirable
end
SW1#show run interface GigabitEthernet 0/2
interface GigabitEthernet0/2
channel-group 1 mode desirable
end
If you want to make any changes like configuring the EtherChannel as a trunk, you need
to do this under the port-channel interface. For example:
SW1(config)#interface Port-channel 1
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
When you do this, the switch automatically adds the commands to the physical
interfaces as well:
68 | P a g e
SW1#show run interface GigabitEthernet 0/1
interface GigabitEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 1 mode desirable
end
interface GigabitEthernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 1 mode desirable
end
You shouldn’t make any changes to the physical interfaces that belong to the
EtherChannel. Always use the port-channel interface.
Let’s continue and take a closer look at the status of the EtherChannel with some show
commands. Here’s the first one:
The show EtherChannel summary command gives a nice clean overview with all your
EtherChannels. It tells us whether the EtherChannel is up and which protocol we use.
Here’s another show command:
Port-channel: Po1
------------
69 | P a g e
Age of the Port-channel = 0d:00h:10m:16s
Logical slot/port = 2/1 Number of ports = 2
GC = 0x00010001 HotStandBy port = null
Port state = Port-channel Ag-Inuse
Protocol = PAgP
Port security = Disabled
Local information:
Hello Partner PAgP Learning Group
Port Flags State Timers Interval Count Priority Method Ifindex
Gi0/1 SC U6/S7 H 30s 1 128 Any 5001
Partner's information:
70 | P a g e
hostname SW1
!
interface GigabitEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 1 mode desirable
!
interface GigabitEthernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 1 mode desirable
!
interface port-channel 1
switchport trunk encapsulation dot1q
switchport mode trunk
!
end
hostname SW2
!
interface GigabitEthernet0/1
channel-group 1 mode auto
!
interface GigabitEthernet0/2
channel-group 1 mode auto
!
interface port-channel 1
!
end
1.2. LACP
LACP is similar to PAgP but uses different terminology:
Active: The interface will actively ask the other side to become an EtherChannel.
Passive: The interface waits passively for the other side to ask to become an
EtherChannel.
At least one switch should use active mode. When both switches use passive mode,
nothing will happen.
Active Passive
Passive Yes No
71 | P a g e
We’ll configure SW1 to use active mode:
Let’s verify our work. We can use the same show commands we use for PAgP:
72 | P a g e
Port-channel: Po1 (Primary Aggregator)
------------
Local information:
LACP port Admin Oper Port Port
Port Flags State Priority Key Key Number State
Gi0/1 SA bndl 32768 0x1 0x1 0x2 0x3D
Partner's information:
As you can see the protocol is now LACP, we have a Port-channel 1 interface with two-
member physical interfaces.
Want to take a look for yourself? Here you will find the final LACP configuration of each
device.
73 | P a g e
hostname SW1
!
interface GigabitEthernet0/1
channel-group 1 mode active
!
interface GigabitEthernet0/2
channel-group 1 mode active
!
interface port-channel 1
!
end
hostname SW2
!
interface GigabitEthernet0/1
channel-group 1 mode passive
!
interface GigabitEthernet0/2
channel-group 1 mode passive
!
interface port-channel 1
!
End
1.3. Manual
Instead of PAgP or LACP, we can also manually enable the Etherchannel. I’ll use the
same topology to demonstrate this:
That’s all there is to it. Let’s try our show commands. We’ll start with an overview:
74 | P a g e
M - not in use, minimum links not met
m - not in use, port not aggregated due to minimum links not met
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
In the output above, you can see we don’t use any protocol. Let’s take a closer look at
the Port-channel interface:
Port-channel: Po1
------------
And we can check one of the two physical interfaces and see the Etherchannel
information:
75 | P a g e
Port index = 0 Load = 0x00 Protocol = -
Want to take a look for yourself? Here you will find the final manual configuration of each
device.
hostname SW1
!
interface GigabitEthernet0/1
channel-group 1 mode on
!
interface GigabitEthernet0/2
channel-group 1 mode on
!
interface port-channel 1
!
end
hostname SW2
!
interface GigabitEthernet0/1
channel-group 1 mode on
!
interface GigabitEthernet0/2
channel-group 1 mode on
!
interface port-channel 1
!
end
76 | P a g e
Use the show etherchannel load-balance command to see what the default configuration
is. As you can see, this switch load balances based on the source MAC address. If you
want, you can change this behavior with the port-channel load-balance command:
SW1(config)#port-channel load-balance ?
dst-ip Dst IP Addr
dst-mac Dst Mac Addr
src-dst-ip Src XOR Dst IP Addr
src-dst-mac Src XOR Dst Mac Addr
src-ip Src IP Addr
src-mac Src Mac Addr
There are plenty of options to choose from, including combinations of source and/or
destination MAC or IP addresses.
Why should you care about load balancing? Take a look at the picture below:
We have SW1 and four computers. On the right side, we have SW2 and a router. The
default load-balancing mechanism is source MAC address. This means that ALL traffic
from one MAC address will be sent down one and the same physical interface, for
example:
77 | P a g e
SW2(config)#port-channel load-balance dst-mac
If we switch the load balancing to destination MAC address on SW2 then traffic from our
router to the computers will be load-balanced amongst the different physical interfaces
because we have multiple computers with different destination MAC addresses.
Want to take a look for yourself? Here you will find the final load-balancing configuration
of each device.
hostname SW1
!
interface GigabitEthernet0/1
channel-group 1 mode active
!
interface GigabitEthernet0/2
channel-group 1 mode active
!
interface port-channel 1
switchport trunk encapsulation dot1q
switchport mode trunk
!
end
hostname SW2
!
interface GigabitEthernet0/1
channel-group 1 mode passive
!
interface GigabitEthernet0/2
channel-group 1 mode passive
!
interface port-channel 1
switchport trunk encapsulation dot1q
switchport mode trunk
!
port-channel load-balance dst-mac
!
end
2. Conclusion
You have now learned what an EtherChannels are and how to configure them:
78 | P a g e
EtherChannels support multiple load-balancing options. Make sure you select a
load-balancing algorithm that matches your traffic patterns.
In a previous lesson I explained how EtherChannel work and how to configure them, but
I didn’t write about layer 3 EtherChannels before. In this lesson, I’ll show you how to
configure them.
A layer 3 etherchannel is similar to an interface on a router. The switch won’t “switch”
traffic on this interface but route it. Because it’s a layer 3 interface, we configure an IP
address on it.
I’ll be using two switches for this:
Before we configure the port channel settings you need to make sure that all interfaces
have the exact same configuration. Once you use the channel-group command, the
port-channel interface will automatically inherit all settings from your physical interface. If
you forget to run the no switchport command on an interface, your etherchannel will be
layer 2 instead of layer 3!
Having said that, let’s configure our switches:
This creates our Etherchannel, we can verify our work like this:
79 | P a g e
w - waiting to be aggregated
d - default port
Above you can see that our port-channel 12 interface is layer 3 and it’s operational. Just
like any other layer 3 interface we can configure an IP address on this port-channel
interface:
SW1(config)#interface port-channel 12
SW1(config-if)#ip address 192.168.12.1 255.255.255.0
SW2(config)#interface port-channel 12
SW2(config-if)#ip address 192.168.12.2 255.255.255.0
SW1#ping 192.168.12.2
No problem at all! If you enabled ip routing on your switch you will see that the switch
uses the port-channel interface in its routing table:
That’s all there is to it, I hope this lesson has been useful to you!
80 | P a g e
1.1.e: Spanning-Tree
Spanning-tree is a protocol that runs on our switches that helps us to solve loops.
Spanning-tree is one of the protocols that you must understand as a network engineer
and you will encounter it for sure if you decide to face the Cisco CCNA R&S exam. This
lesson is an introduction to spanning-tree, you will learn why we need it, how it works
and how you can check the spanning-tree topology on your Cisco switches.
In the picture above we have two switches. These switches are connected to each other
with a single cable so there is a single point of failure. To get rid of this single point of
failure we will add another cable:
81 | P a g e
With the extra cable we now have redundancy. Unfortunately for us redundancy also
brings loops. Why do we have a loop in the scenario above? Let me describe it to you:
1. H1 sends an ARP request because it’s looking for the MAC address of H2. An
ARP request is a broadcast frame.
2. SW1 will forward this broadcast frame on all it interfaces, except the interface
where it received the frame on.
3. SW2 will receive both broadcast frames.
82 | P a g e
We have three switches and as you can see, we have added redundancy by connecting
the switches in a triangle, this also means we have a loop here. I have added the MAC
addresses but simplified them for this example:
SW1: MAC AAA
SW2: MAC BBB
SW3: MAC CCC
Since spanning tree is enabled, all our switches will send a special frame to each other
called a BPDU (Bridge Protocol Data Unit). In this BPDU there are two pieces of
information that spanning-tree requires:
MAC address
Priority
The MAC address and the priority together make up the bridge ID. The BPDU is sent
between switches as shown in the following picture:
83 | P a g e
Spanning-tree requires the bridge ID for its calculation. Let me explain how it works:
First of all, spanning tree will elect a root bridge; this root-bridge will be the one
that has the best “bridge ID”.
The switch with the lowest bridge ID is the best one.
By default, the priority is 32768 but we can change this value if we want.
So, who will become the root bridge? In our example SW1 will become the root bridge!
Priority and MAC address make up the bridge ID. Since the priority is the same on all
switches it will be the MAC address that is the tiebreaker. SW1 has the lowest MAC
address thus the best bridge ID and will become the root bridge.
The ports on our root bridge are always designated which means they are in
a forwarding state. Take a look at the following picture:
Above you see that SW1 has been elected as the root bridge and the “D” on the
interfaces stands for designated.
Now we have agreed on the root bridge our next step for all our “non-root” bridges (so
that’s every switch that is not the root) will have to find the shortest path to our root
bridge! The shortest path to the root bridge is called the “root port”. Take a look at my
example:
84 | P a g e
I’ve put an “R” for “root port” on SW2 and SW3, their Fa0/0 interface is the shortest
path to get to the root bridge. In my example I’ve kept things simple but “shortest path” in
spanning tree means it will actually look at the speed of the interface. Each interface
has a certain cost and the path with the lowest cost will be used. Here’s an overview of
the interfaces and their cost:
10 Mbit = Cost 100
100 Mbit = Cost 19
1000 Mbit = Cost 4
Excellent…we have designated ports on our root bridge and root ports on our non-root
bridges, we still have a loop however, so we need to shut down a port between SW2 and
SW3 to break that loop. So which port are we going to shut down? The one on SW2 or
the one on SW3? We’ll look again at the best bridge ID:
Bridge ID = Priority + MAC address.
Lower is better, both switches have the same priority but the MAC address of SW2 is
lower, this means that SW2 will “win this battle”. SW3 is our loser here which means it
will have to block its port, effectively breaking our loop! Take a look at my example:
85 | P a g e
If you look at the link between SW2 and SW3 you can see that the Fa1/0 interface of
SW3 says “A” which stands for alternate. An alternate port is blocked! Sometimes the
alternate port is called the ND (Non-Designated) port. By shutting down this interface
we have solved our loop problem.
Because the default priority is 32768 the tie-breaker for selecting the root bridge is the
MAC address. In a production network what switch do you think will be elected as the
root bridge?
Your brand spanking new switch or that dirty old switch that has been used as a dust
collector for the last 8 years?
The old switch probably has a lower MAC address and thus will be elected as the root
bridge. Doesn’t sound like a good idea right? That’s why we can change the priority to
determine what switch will become the root bridge.
Are you following me so far? Good! You just learned the basics of spanning-tree. Let’s
add some more detail to this story…
Let’s continue our spanning tree story and further enhance your knowledge. If you have
played with some Cisco switches before you might have noticed that every time you
plugged in a cable the led above the interface was orange and after a while became
green. What is happening at this moment is that spanning tree is determining the state of
the interface; this is what happens as soon as you plug in a cable:
The port is in listening mode for 15 seconds. In this phase it will receive and
send BPDUs, still neither learning MAC addresses nor data transmission.
The port is in learning mode for 15 seconds. We are still sending and receiving
BPDUs but now the switch will also learn MAC addresses, still no data
transmission though.
Now we go in forwarding mode and finally we can start transmitting data!
Here’s a picture to visualize it:
86 | P a g e
`
This is the topology we will use. Spanning-tree is enabled by default; let’s start by
checking some show commands.
SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 000f.34ca.1000
Cost 19
Port 19 (FastEthernet0/17)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
87 | P a g e
Address 0011.bb0b.3600
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
The show spanning-tree command is the most important show command to remember.
There’s quite some stuff here so I’m going to break it down for you!
VLAN0001
Spanning tree enabled protocol ieee
We are looking at the spanning-tree information for VLAN 1. Spanning-tree has multiple
versions and the default version on Cisco switches is PVST (Per VLAN spanning-tree).
This is the spanning-tree for VLAN 1
Here you see the information of the root bridge. You can see that it has a priority of
32769 and its MAC address is 000f.34ca.1000. From the perspective of SW1 it has a
cost of 19 to reach the root bridge. The port that leads to the root bridge is called the root
port and for SW1 this is fa0/17.
This part shows us the information about the local switch, SW1 in our case. There’s
something funny about the priority here….you can see it show two things:
Priority 32769
Priority 32768 sys-id-ext 1
The sys-id-ext value that you see is the VLAN number. The priority is 32768 but
spanning-tree will add the VLAN number so we end up with priority value 32769. Last
but not least we can see the MAC address of SW1 which is 0011.bb0b.3600.
88 | P a g e
Here’s some information on the different times that spanning-tree uses:
Hello time: every 2 seconds a BPDU is sent.
Max Age: If we don’t receive BPDUs for 20 seconds we know something has
changed in the network and we need to re-check the topology.
Forward Delay: This timer is used for the listening and learning states. We remain
in each state for the duration of the forward delay which is 15 seconds by default.
The last part of the show spanning-tree commands shows us the interfaces and their
status. SW1 has two interfaces:
Fa0/14 is a designated port and in (FWD) forwarding mode.
Fa0/17 is a root port and in (FWD) forwarding mode.
The prio.nbr you see here is the port priority that I explained earlier. We’ll play with this
in a bit.
Because only non-root switches have a root-port I can conclude that SW1 is a non-root
switch. I know that fa0/17 on SW1 leads to the root bridge.
Let’s take a look at SW2 to see what we find:
SW2#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 000f.34ca.1000
Cost 19
Port 18 (FastEthernet0/16)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
89 | P a g e
Root ID Priority 32769
Address 000f.34ca.1000
Cost 19
Port 18 (FastEthernet0/16)
Here we see information about the root bridge. This information is similar to what we
saw on SW1. The root port for SW2 seems to be fa0/16.
This is the information about SW2. The priority is the same as on SW1, only the MAC
address (0019.569d.5700) is different.
This part looks interesting; there are two things we see here:
Interface fa0/14 is an alternate port and in (BLK) blocking mode.
Interface fa0/16 is a root port and in (FWD) forwarding mode.
SW3#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 000f.34ca.1000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
90 | P a g e
---------------- ---- --- --------- --------
--------------------------------
Fa0/14 Desg FWD 19 128.14 P2p
Fa0/16 Desg FWD 19 128.16 P2p
Bingo… SW3 is the root bridge in this network. We already knew that because SW1 and
SW2 are both non-root, but this is how we verify it by looking at SW3.
91 | P a g e
SW3: 000f.34ca.1000
SW3 has the lowest MAC address so that’s why it became root bridge. Why was the
fa0/14 interface on SW2 blocked and not the fa0/14 interface on SW1? Once again we
have to look at the bridge identifier. The priority is 32768 on both switches so we have to
compare the MAC address:
SW1: 0011.bb0b.3600
SW2: 0019.569d.5700
SW1 has a lower MAC address and thus a better bridge identifier. That’s why SW2 lost
this battle and has to shut down its fa0/14 interface.
That’s it! You have now learned how spanning-tree works and how you can check the
spanning-tree topology on your Cisco switches.
Non-root bridges need to find the shortest path to the root bridge. What will happen if
we have a mix of different interface types like Ethernet, FastEthernet and Gigabit? Let’s
find out!
Here’s the topology I will use to explain the spanning-tree cost calculation:
In the picture above we have a larger network with multiple switches. You can also see
that there are different interface types, we have Ethernet (10 Mbit), FastEthernet
(100Mbit) and Gigabit (1000Mbit). SW1 on top is the root bridge so all other switches are
non-root and need to find the shortest path to the root bridge.
Bandwidth Cost
10 Mbit 100
100 Mbit 19
92 | P a g e
1000 Mbit 4
Spanning-tree uses cost to determine the shortest path to the root bridge. The slower
the interface, the higher the cost is. The path with the lowest cost will be used to reach
the root bridge.
Here’s where you can find the cost value:
In the BPDU you can see a field called root path cost. This is where each switch will
insert the cost of its shortest path to the root bridge. Once the switches found out
which switch is declared as root bridge, they will look for the shortest path to get
there. BPDUs will flow from the root bridge downwards to all switches.
If you studied CCNA or CCNP ROUTE, then this story about spanning-tree cost might
sound familiar. OSPF (Open Shortest Path First) also uses cost to calculate the shortest
path to its destination. Both spanning-tree and OSPF use cost to find the shortest path
but there is one big difference. OSPF builds a topology database (LSDB) so all routers
know exactly what the network looks like. Spanning-tree is “dumb”…switches have no
idea what the topology looks like. BPDUs flow from the root bridge downwards to all
switches, switches will make a decision based on the BPDUs that they receive!
SW2 will use the direct link to SW1 as its root port since this is a 100 Mbit interface and
has a cost of 19. It will forward BPDUs towards SW4; in the root path cost field of the
BPDU you will find a cost of 19. SW3 is also receiving BPDUs from SW1 so it’s possible
that at this moment it selects its 10 Mbit interface as the root port. Let’s continue…
93 | P a g e
This picture needs some more explanation so let me break it down:
SW3 receives BPDUs on its 10 Mbit interface (cost 100) and on its 1000 Mbit
interface (cost 4). It will use its 1000 Mbit interface as its root port (shortest path
to the root bridge is 19+19+4=42).
SW3 will forward BPDUs to SW4. The root path cost field will be 100.
SW4 receives a BPDU from SW2 with a root path cost of 19.
SW4 receives a BPDU from SW3 with a root path cost of 100.
The path through SW2 is shorter so this will become the root port for SW4.
SW4 will forward BPDUs towards SW3 and SW5. In the root path cost field of the
BPDU we will find a cost of 38 (its root path cost of 19 + its own interface cost of
19).
SW3 will forward BPDUs towards SW5 and inserts a cost of 42 in the root path
cost field (19 + 19 + 4).
The complete picture will look like this:
94 | P a g e
SW5 receives BPDUs from SW3 and SW4. In the BPDU we will look at the root path
cost field and we’ll see the following information:
BPDU from SW3: cost 42
BPDU from SW4: cost 38
SW5 will add the cost of its own interface towards SW4 so the total cost to reach the root
bridge through SW4 is 38 + 19 (cost of 100 Mbit interface) = 57. The total cost to reach
the root bridge through SW3 is 42 + 100 (10 Mbit interface) = 142. As a result, it will
select the interface towards SW4 as its root port.
Are you following me so far? Keep in mind that switches only make decisions on the
BPDUs that they receive! They have no idea what the topology looks like. The only thing
they do know is on which interface they received the best BPDU. The best BPDU is the
one with the shortest path to the root bridge!
What if the cost is equal?
Take a look at the picture above. SW1 is the root bridge and SW2 is non-root. We have
two links between these switches so that we have redundancy. Redundancy means
loops so spanning-tree is going to block one the interfaces on SW2.
SW2 will receive BPDUs on both interfaces but the root path cost field will be the same!
Which one are we going to block? Fa0/1 or fa0/2? When the cost is equal spanning-tree
will look at the port priority. By default, the port priority is the same for all
interfaces which means that the interface number will be the tie-breaker.
95 | P a g e
The lowest interface number will be chosen so fa0/2 will be blocked here. Of course, port
priority is a value that we can change so we can choose which interface will be blocked,
I’ll show you later how to do this!
Whenever spanning-tree has to make a decision, it uses the following list:
Lowest bridge ID: the switch with the lowest bridge ID becomes the root bridge.
Lowest path cost to root bridge: when the switch receives multiple BPDUs it
will select the interface that has the lowest cost to reach the root bridge as the
root port.
Lowest sender bridge ID: when a switch is connected to two switches that it can
use to reach the root bridge and the cost to reach the root bridge is the same, it
will select the interface connecting to the switch with the lowest bridge ID as the
root port.
Lowest sender port ID: when the switch has two interfaces connecting to the
same switch, and the cost to reach the root bridge is the same it will use the
interface with the lowest number as the root port.
If you have played with some Cisco switches before you might have noticed that every
time you plug in a cable the led above the interface was orange and after a while
became green. What is happening at this moment is that spanning tree is determining
the state of the interface.
This is what happens as soon as you plug in a cable:
Listening state: Only a root or designated port will move to the listening state.
The non-designated port will stay in the blocking state. No data transmission
occurs at this state for 15 seconds just to make sure the topology doesn’t change
in the meantime. After the listening state we move to the learning state.
Learning state: At this moment the interface will process Ethernet frames by
looking at the source MAC address to fill the mac-address-table. Ethernet frames
however are not forwarded to the destination. It takes 15 seconds to move to the
next state called the forwarding state.
Forwarding state: This is the final state of the interface and finally the interface
will forward Ethernet frames so that we have data transmission!
When a port is not a designated or root port it will be in blocking mode.
This means it takes 30 seconds in total to move from listening to forwarding…that’s not
really fast right? This will happen on all interfaces on the switch.
When an interface is in blocking mode and the topology changes, it’s possible that an
interface that is currently in blocking mode has to move to the forwarding state. When
96 | P a g e
this is the case, the blocking mode will last for 20 seconds before it moves to the
listening state. This means that it takes 20 (blocking) + 15 (listening) + 15 (learning) = 50
seconds before the interface is in the forwarding state.
30 seconds is a long time, right? Any modern PC with a SSD drive boots faster than
that. Here’s an overview of the different port states:
Blocking No No 20 seconds
Listening No No 15 seconds
So, what does this look like on an actual Cisco switch? Let me show you an example of
an interface that is connected to a router. I just unplugged and plugged the cable (or do
a” shut” and “no shut”) and the first time we run the show command it looks like this:
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0019.569d.5700
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
You can see that the role of the port is designated, and the status is listening. Keep
refreshing this show command and after ~ 15 seconds it looks like this:
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0019.569d.5700
97 | P a g e
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
It has moved to the learning state and after another ~ 15 seconds it looks like this:
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0019.569d.5700
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Very nice, you just witnessed an interface moving through the different spanning tree
port states. A better method to see the changes is by enabling a debug:
When we disable and enable the interface again you can see it moving through the
spanning tree port states in real-time:
SW1#
00:14:57: STP: VLAN0001 Fa0/1 -> listening
00:15:12: STP: VLAN0001 Fa0/1 -> learning
00:15:27: STP: VLAN0001 Fa0/1 -> forwarding
98 | P a g e
How does spanning-tree deal with topology changes? This is a topic that isn’t (heavily)
tested on the CCNP SWITCH exam but it’s very important to understand if you deal with
a network with a lot of switches.
Let me show you an example so I can explain a couple of things:
Let’s take a look at the picture above. We have two computers because I need
something to fill the MAC address tables of these switches. All switches have the default
configuration.
SW2(config)#interface fa0/19
SW2(config-if)#spanning-tree cost 50
I want SW3 to be the root bridge and the fa0/19 interface of SW2 should be blocked. I’ll
show you why in a minute. Let’s see what the state is of all these interfaces:
99 | P a g e
SW4#show spanning-tree | begin Interface
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Fa0/4 Desg FWD 19 128.4 P2p
Fa0/16 Desg FWD 19 128.16 P2p
Fa0/19 Root FWD 19 128.19 P2p
So here we have all the different interfaces, time to draw a nice picture!
Traffic between H1 and H2 will flow from SW2 to SW1, SW3 and then towards SW4.
Interface fa0/19 on SW2 has been blocked.
Let’s generate some traffic so the switches learn the MAC addresses of the computers:
A simple ping will generate some frames and the switches will learn the MAC addresses.
In my case these are the MAC addresses for the computers:
H1: 000c.2928.5c6c
H2: 000c.29e2.03ba
100 | P a g e
-------------------------------------------
We can confirm the traffic path by looking at the MAC address table. I like to use
the show mac address-table dynamic command, so we don’t have to browse through
a list of static MAC addresses.
Do you have any idea how long a switch will store a MAC address?
If we look at one of the switches, we can check the default aging time of the MAC
address table. As you can see this is 300 seconds (5 minutes by default). If a host has
been silent for 5 minutes its MAC address will be removed from the table.
Why do we care about aging time? I’ll show you why!
First, I’m going to get some traffic going from H1 to H2. By using ping –t it will run
forever.
The next step will be to unplug one of the cables:
101 | P a g e
Assume the link between SW1 and SW3 fails. H1 and H2 will be unable to communicate
with each other until the fa0/19 interface of SW2 goes into forwarding.
It will take a maximum of 50 seconds for SW2 to move the fa0/19 interface from blocking
to listening, learning and finally the forwarding state.
Meanwhile SW2 still has the MAC address of H2 in its MAC address table and will keep
forwarding it to SW1 where it will be dropped. It will be impossible for our computers to
communicate with each other for 300 seconds until the MAC address tables age out.
“Sending Ethernet frames to a place where no frame has gone before doesn’t sound like
a good idea if you want to keep your users happy…”
The idea of MAC address tables that age out after 300 seconds works perfectly fine in a
stable network but not when the topology changes. Of course, there’s a solution to every
problem and that’s why spanning-tree has a topology change mechanism.
When a switch detects a change in the network (interface going down or into forwarding
state) it will advertise this event to the whole switched network.
102 | P a g e
When the switches receive this message, they will reduce the aging time of the MAC
address table from 300 seconds to 15 seconds (this is the forward delay timer). This
message is called the TCN (Topology Change Notification).
To take a closer look at the TCN we’ll have to do some debugging…
I’m going to enable debug spanning-tree events on all switches so you can see this
process in action.
Now we will shut the Interface fa0/16 on SW1 to simulate a link failure:
SW1(config)#interface fa0/16
SW1(config-if)#shutdown
You will see quite some debug information but somewhere along the lines you’ll see that
SW1 is generating a topology change notification and sends it on its fa0/14 interface to
SW2. Here’s what you see on SW2:
SW2 will throw quite some debug stuff in your face but this is what I was looking for. You
can see that it received the topology change notification from SW1. Upon arrival of this
topology change notification SW2 will age out its MAC address table in 15 seconds.
What will SW2 do with this information? Look below:
103 | P a g e
SW2#STP: VLAN0001 sent Topology Change Notice on Fa0/19
SW2#STP: VLAN0001 Fa0/19 -> forwarding
SW2 decides that fa0/19 is now the new root port and you can see the transition from
listening to learning and forwarding mode. It’s also sending a topology change
notification towards SW4.
SW3 receives a topology change notification on its fa0/19 interface and will reduce its
age out timer of the MAC address table to 15 seconds.
Here we see that SW4 receives the topology change notification from SW2 and as a
result it will reduce its age out timer of the MAC address table to 15 seconds. It’s also
sending a topology change notification to SW3.
All switches received the topology change notification and set their age out timer to 15
seconds. SW2 doesn’t receive any Ethernet Frames with the MAC address of H2 as the
source on its fa0/14 interface and will remove this entry from the MAC address table.
Meanwhile the fa0/19 interface on SW2 changed from blocking to listening, learning and
forwarding state (50 seconds total). SW2 will now learn the MAC address of H2 on its
fa0/19 interface and life is good!
Of course, the same thing will happen for the MAC address of H1 on SW4.
104 | P a g e
Are you following me so far? To keep a long story short…we need the topology change
notification to reduce the MAC address table aging timer from 300 seconds to 15
seconds to prevent blackholing traffic in a situation like I just explained to you.
So which switches will send and forward the topology change notifications? In our
previous debug you saw a couple of messages but where do we send them and why? Is
it flooded to all switches? Let’s check it out!
In a normal situation a non-root switch will receive BPDUs on its root port but will never
send any BPDUs to the root bridge. When a non-root switch detects a topology change it
will generate a topology change notification and send it on its root port towards the root
bridge.
When a switch receives the topology change notification it will send a (TCA) topology
change acknowledgement on its designated port towards the downstream switch. It will
create a topology change notification itself and send it on its root port as well…we will
work our way up the tree until we reach the root bridge.
What kind of message is used for the TCN? Take a look at this BPDU:
105 | P a g e
You can see it has a field called BPDU type. This value will change to indicate it’s a
topology change notification.
Once the topology change notification reaches the root bridge it will set the TC (topology
change) bit in the BPDUs it will send.
These BPDUs will be forwarded to all the other switches in our network so they can
reduce their aging time of the MAC address table. Switches will receive these messages
on both forwarding and blocked ports.
The root bridge will send BPDUs and it will set the flag field to represent the topology
change.
That’s all there is to it. This is how spanning-tree deals with topology changes in our
network. There is one more thing I want to you show you about this mechanism. Take a
look at the picture below:
106 | P a g e
As you can see H1 is connected to SW2 on its fa0/2 interface. Let’s see what happens
when this interface goes down.
We can see that the fa0/2 interface on SW2 is designated and forwarding. Let’s enable a
debug and shut this interface:
Right after shutting down the fa0/2 SW2 generates a topology change notification and
sends it away on its root port.
Let’s bring it up again:
SW2(config)#interface f0/2
SW2(config-if)#no shutdown
107 | P a g e
SW2# STP: VLAN0001 Fa0/2 -> listening
SW2# %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up
SW2# %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, SW2# changed
state to up
SW2# STP: VLAN0001 Fa0/2 -> learning
SW2# STP: VLAN0001 sent Topology Change Notice on Fa0/14
SW2# STP: VLAN0001 Fa0/2 -> forwarding
Once we bring the interface up you can see it goes through the listening and learning
state and ends in the forwarding state. The switch generates another topology change
notification and sends it on the root port.
What kind of issues could this cause? Imagine we have a network with a LOT of hosts.
Each time an interface goes up or down a topology change notification will be generated
and ALL switches will set their aging time to 15 seconds. A host will trigger a topology
change and if you have a lot of hosts it’s possible that you end up with a network that is
in a constant state of “topology changes”.
Here’s a situation that could occur:
In the picture above I have a server sending a backup to a LAN backup device. This
means we’ll probably have a lot of unicast traffic from the server to the LAN backup
device.
Whenever an interface goes down it will generate a topology change notification and as
a result all switches will reduce their aging time of the MAC address table to 15 seconds.
All the MAC addresses of the devices will be flushed from the MAC address table.
The switches will quickly re-learn the MAC address of the server since its actively
sending traffic to the LAN Backup device. If this LAN Backup device is just silently
receiving traffic and not sending any traffic itself then there’s no way for the switches to
re-learn its MAC address.
108 | P a g e
What happens to unknown MAC unicast traffic? That’s right…it’s flooded on all
interfaces except the one where it originated from. As a result, this network will be
burdened with traffic until our LAN Backup device sends an Ethernet Frame and the
switches re-learn its MAC address.
How can we deal with this drama scenario?
Portfast to the rescue! Portfast is a Cisco proprietary solution to deal with topology
changes. It does two things for us:
Interfaces with portfast enabled that come up will go to forwarding mode
immediately. It will skip the listening and learning state.
A switch will never generate a topology change notification for an interface that
has portfast enabled.
It’s a good idea to enable portfast on interfaces that are connected to hosts because
these interfaces are likely to go up and down all the time. Don’t enable portfast on an
interface to another hub or switch.
Spanning-Tree Reconvergence
Most students are familiar with the basics of (classic) spanning-tree: how a root bridge is
elected, how the switches decide what interfaces become designated, non-designated,
root ports, etc.
Once the topology has converged, it doesn’t stop. Every time a switch receives a BPDU,
it has to make decisions. When the topology remains the same then the switch will keep
making the same decisions over and over again.
Things become interesting when we do have a change in the topology. How does
spanning-tree adapt to changes in the network?
In this lesson, we’ll take a look at what happens behind the scenes when the topology
changes. I’ll show you the different BPDUs and the decisions that each switch will make.
1. Converged Topology
To demonstrate this, I will use the following topology:
109 | P a g e
Above we have five switches. SW1 is the root bridge. Let’s check the current status of all
interfaces:
SW1#show spanning-tree | begin Interface
Interface Role Sts Cost Prio.Nbr Type
------------------- ---- --- --------- -------- --------------------------------
Gi0/1 Desg FWD 4 128.2 P2p
Gi0/2 Desg FWD 4 128.3 P2p
110 | P a g e
Let’s create a simple diagram that has all the port statuses:
Before we start messing around with topology changes. Let’s take a look at the different
BPDUs that we see on the network.
To make sense out of the different BPDUs, let me give you an overview of all MAC
addresses that we will encounter:
111 | P a g e
The MAC addresses in red are the MAC addresses that are used as the bridge
identifiers. Spanning-tree will select a MAC address of one of your (lowest) interface
numbers. In my case, those were the GigabitEthernet 0/0 interfaces that I am not using
in this topology. The MAC addresses in black are those of the interfaces.
Let’s start with the BPDU that our root bridge (SW1) creates:
Above we see the BPDU that SW1 sends towards SW2. You can see the bridge
identifier with the MAC address of SW1. I set the bridge priority to 0. Also, we can see
the message age is 0. This value determines how far you are away from the root bridge.
Each non-root bridge will increase this value by 1.
The message age is used to determine when a BPDU expires. You take the max age
value (20) – message age (0) = 20 seconds. Switches further away from the root bridge
will expire their BPDUs sooner.
Here’s the same BPDU but it’s sent towards SW3:
112 | P a g e
The contents of this BPDU are the same except for the source address.
Above you can see the BPDU from SW1, the message age has been increased by 1.
This means that this BPDU will expire in 20 (max age) – 1 (message age) = 19 seconds.
Here’s the BPDU that SW3 relays to SW5:
113 | P a g e
The information in the BPDU is similar.
Between SW4 and SW5, only SW4 is forwarding BPDUs since the GigabitEthernet0/2
interface of SW5 is currently blocked. Here’s what the BPDU looks like:
114 | P a g e
Our switches will keep flooding the BPDUs that you have seen above, as long as the
topology remains the same. Time to stir up the hornet’s nest…
2. Reconvergence
We are going to shut one of the interfaces of SW1 so that the spanning-tree topology
changes. Some of our switches will lose their root ports. If we want to see everything in
action, we’ll have to enable a debug:
All of our switches will produce some debug info, let’s look at them one-by-one. We start
with SW1:
SW1#
02:50:32: STP: VLAN0001 we are the spanning tree root
02:50:32: STP[1]: Generating TC trap for port GigabitEthernet0/1
02:50:52: STP: VLAN0001 Topology Change rcvd on Gi0/2
02:50:52: STP: VLAN0001 Topology Change rcvd on Gi0/2/code>
SW1 is the root bridge and generates a topology change trap, nothing else happens
here. You can see this event occurs at 2:50:32.
Let’s check SW2:
SW2#
02:51:09: STP: VLAN0001 heard root 32769-fa16.3e5d.b4a0 on Gi0/2
02:51:09: STP: VLAN0001 Topology Change rcvd on Gi0/2
02:51:09: STP: VLAN0001 sent Topology Change Notice on Gi0/1
02:51:10: STP: VLAN0001 heard root 32769-fa16.3e5d.b4a0 on Gi0/2
02:51:10: supersedes 32769-fa16.3e95.a9c9
02:51:10: STP: VLAN0001 new root is 32769, fa16.3e5d.b4a0 on port Gi0/2, cost 4
02:51:10: STP: VLAN0001 sent Topology Change Notice on Gi0/2
02:51:11: STP: VLAN0001 heard root 1-fa16.3eca.4096 on Gi0/2
02:51:11: supersedes 32769-fa16.3e5d.b4a0
02:51:11: STP: VLAN0001 new root is 1, fa16.3eca.4096 on port Gi0/2, cost 16
115 | P a g e
SW2 is no longer receiving BPDUs from SW1 so it has to select another root port. You
can see it is receiving a BPDU from SW4 (fa16.3e5d.b4a0) who claims that it is the new
root bridge, superseding SW2 as the root bridge (fa16.3e95.a9c9).
For a short while, SW2 and SW4 are both isolated from receiving BPDUs from SW1
since SW5 is not forwarding any BPDUs on its blocked interface. About a second later,
SW2 does receive the superior BPDU that is originated from SW1 and uses this as the
root port.
The new root port was discovered at 02:51:11 so it took about 39 seconds.
Below you can see the BPDU that SW2 generated when it thought it was the new root
bridge:
And here’s the BPDU from SW4 who claimed to be the new root bridge:
116 | P a g e
Let’s check SW3:
SW3#
02:50:38: STP: VLAN0001 Topology Change rcvd on Gi0/2
02:50:38: STP: VLAN0001 sent Topology Change Notice on Gi0/1
02:51:05: STP: VLAN0001 Topology Change rcvd on Gi0/2
02:51:05: STP: VLAN0001 sent Topology Change Notice on Gi0/1
Nothing much happens on SW3. This makes sense it’s root and designated ports didn’t
change when GigabitEthernet0/1 on SW1 went down.
Let’s check SW4:
SW4#
02:51:16: STP: VLAN0001 heard root 1-fa16.3eca.4096 on Gi0/1
02:51:16: supersedes 32769-fa16.3e5d.b4a0
02:51:16: STP: VLAN0001 new root is 1, fa16.3eca.4096 on port Gi0/1, cost 8
02:51:16: STP: VLAN0001 sent Topology Change Notice on Gi0/1
02:51:17: STP: VLAN0001 Topology Change rcvd on Gi0/1
02:51:17: STP: VLAN0001 heard root 1-fa16.3eca.4096 on Gi0/2
02:51:17: supersedes 32769-fa16.3e5d.b4a0
02:51:17: STP: VLAN0001 new root is 1, fa16.3eca.4096 on port Gi0/2, cost 12
02:51:17: STP: VLAN0001 sent Topology Change Notice on Gi0/2
117 | P a g e
SW4 was temporarily thinking that it was the new root bridge since it doesn’t receive
BPDUs from SW5. Within the same second, SW2 has sent the superior BPDU from
SW1 so for a short while, SW4 reconsiders Gi0/1 as its root port. Once SW5 starts
forwarding BPDUs, SW4 will use this interface as its root port.
Last but not least, here’s SW5:
SW5#
02:50:43: STP: VLAN0001 Gi0/2 -> listening
02:50:45: STP: VLAN0001 Topology Change rcvd on Gi0/2
02:50:45: STP: VLAN0001 sent Topology Change Notice on Gi0/1
02:50:58: STP: VLAN0001 Gi0/2 -> learning
02:51:13: STP[1]: Generating TC trap for port GigabitEthernet0/2
02:51:13: STP: VLAN0001 sent Topology Change Notice on Gi0/1
02:51:13: STP: VLAN0001 Gi0/2 -> forwarding
SW5 is not receiving any superior BPDUs anymore from SW1 on its GigabitEthernet0/2
interface. This causes it to leave blocking mode, entering the listening and learning
state, ending in forwarding mode.
Here’s the BPDU that SW5 forwards to SW4:
For the sake of completeness, here’s an overview with the new interface states:
118 | P a g e
------------------- ---- --- --------- -------- --------------------------------
Gi0/2 Desg FWD 4 128.3 P2p
119 | P a g e
2.2. Shutting GigabitEthernet0/2 on SW1
Let’s try something else. We will start again with the topology where both interfaces on
SW1 are in forwarding mode. I’m going to shut the GigabitEthernet 0/2 interface this
time:
SW1(config)#interface GigabitEthernet 0/2
SW1(config-if)#shutdown
SW1#
03:00:01: STP: VLAN0001 we are the spanning tree root
03:00:01: STP[1]: Generating TC trap for port GigabitEthernet0/2
03:00:20: STP: VLAN0001 Topology Change rcvd on Gi0/1
03:00:50: STP: VLAN0001 Topology Change rcvd on Gi0/1
SW2#
03:00:40: STP: VLAN0001 Topology Change rcvd on Gi0/2
03:00:40: STP: VLAN0001 sent Topology Change Notice on Gi0/1
03:01:09: STP: VLAN0001 Topology Change rcvd on Gi0/2
03:01:09: STP: VLAN0001 sent Topology Change Notice on Gi0/1
120 | P a g e
Nothing interesting happens on SW2 since its root port remains the same.
Here’s SW3:
SW3#
03:00:05: STP: VLAN0001 heard root 1-fa16.3eca.4096 on Gi0/2
03:00:05: supersedes 32769-fa16.3e65.f2bc
03:00:05: STP: VLAN0001 new root is 1, fa16.3eca.4096 on port Gi0/2, cost 16
03:00:05: STP: VLAN0001 sent Topology Change Notice on Gi0/2
SW3 loses its root port and for a short moment, it sees itself as the root bridge before it
receives the superior BPDU from SW1 on its Gigabit0/2 interface. This becomes its new
root port. Here’s the BPDU when SW3 saw itself as the root bridge:
SW4#
03:00:47: STP: VLAN0001 Topology Change rcvd on Gi0/2
03:00:47: STP: VLAN0001 sent Topology Change Notice on Gi0/1
03:01:16: STP: VLAN0001 Topology Change rcvd on Gi0/2
03:01:16: STP: VLAN0001 sent Topology Change Notice on Gi0/1
Nothing much happens on SW4. It’s root and designated ports remain the same.
Last but not least, here’s SW5:
121 | P a g e
SW5#
03:00:12: STP: VLAN0001 new root port Gi0/2, cost 12
03:00:12: STP: VLAN0001 Gi0/2 -> listening
03:00:13: STP: VLAN0001 heard root 32769-fa16.3e65.f2bc on Gi0/1
03:00:13: STP: VLAN0001 Topology Change rcvd on Gi0/1
03:00:13: STP: VLAN0001 sent Topology Change Notice on Gi0/2
03:00:27: STP: VLAN0001 Gi0/2 -> learning
03:00:42: STP[1]: Generating TC trap for port GigabitEthernet0/2
03:00:42: STP: VLAN0001 sent Topology Change Notice on Gi0/2
03:00:42: STP: VLAN0001 Gi0/2 -> forwarding
SW5 is no longer receiving BPDUs from SW1 on its GigabitEthernet 0/1 interface so it
loses its root port (GigabitEthernet0/1) and it has to figure out which interface will
become the new root port. Since SW3 temporarily claimed itself as the root bridge, SW5
is receiving this BPDU.
It is also receiving the superior BPDU from SW1 on its GigabitEthernet 0/2 interface so
this interface will move from the blocking state to the listening, learning and forwarding
state. This becomes the new root port.
Here’s an overview with the new port states:
122 | P a g e
And the topology now looks like this:
3. Conclusion
In this lesson, we have seen what happens behind the scenes when spanning-tree has
to reconverge. You have seen the decisions that each switch makes based on the
BPDUs they receive (or don’t receive).
Since you are reading this, I assume you understand how “classic” spanning-tree works.
If you don’t, it’s best to read my Introduction to spanning-tree first before you continue.
Having said that, let’s start with a nice picture:
123 | P a g e
VLAN 10 is configured on SW1 and SW2.
VLAN 20 is configured on SW1, SW2 and SW3.
Question for you: do we have a loop in VLAN 10? What about VLAN 20?
There’s a big difference between our physical and logical topology. We don’t have a
loop in VLAN 10 because it only runs on the link between SW1 and SW2. We DO have a
loop within VLAN 20 however.
How does spanning-tree deal with this? Simple…we’ll just calculate a different spanning-
tree for each VLAN! The oldest version of spanning-tree is called CST (Common
Spanning-Tree) and is defined in the 802.1D standard. It only calculates a single
spanning-tree for all VLANs.
Another version of spanning-tree is able to calculate a topology for each VLAN. This
version is called PVST (Per VLAN Spanning-Tree) and it’s the default on Cisco
switches.
Beginning from Cisco IOS 15.2(4)E release, the STP default mode is Rapid PVST+
Let’s look at an example where we have three switches and two VLANs. Both VLANs
are available on all switches:
124 | P a g e
Above you can see that we have two root bridges. If we use PVST we can create a
different root bridge for each VLAN if we want. SW1 could be the root bridge for VLAN
10 and SW2 could be the root bridge for VLAN 20. Why would you want to do this?
Here’s an example:
If I would make one switch root bridge for both VLANs then one interface will be blocked
for both VLANs. In my example above SW1 is the root bridge for VLAN 10 and 20 and
as a result the fa0/16 interface on SW3 is blocked for both VLANs. No traffic will be
forwarded on the fa0/16 interface at all. Imagine these were 10 Gigabit interfaces. It
would be a shame if one of those expensive interfaces wasn’t doing anything right?
If I choose another switch as the root bridge for VLAN 20 we will see different results:
125 | P a g e
In my example, I made SW2 the root bridge for VLAN 20. As you can see the fa0/16
interface on SW2 is blocked for VLAN 10 while the fa0/17 interface on SW1 is blocked
for VLAN 20. The advantage of having multiple root bridges is that I can do some load
sharing/balancing.
126 | P a g e
I have two switches and one host connected to SW1. The only reason I have two
switches is so SW1 has another switch that it can send topology notification changes to.
Let’s look at the without portfast scenario first…
1. Portfast disabled
To see the interesting stuff, I will enable a debug on SW1:
Once I plug in the cable to connect the host to SW1 this is what happens:
SW1#
STP: VLAN0001 Fa0/1 -> listening
STP: VLAN0001 Fa0/1 -> learning
STP: VLAN0001 Fa0/1 -> forwarding
This is just normal spanning-tree behavior, it walks through the listening and learning
states and ends up in forwarding.
Each time I unplug the cable, spanning-tree will generate a topology change notification.
There’s a nice command that you can use to check how many have been sent so far:
As you can see there have been 5 topology changes so far on VLAN 1. Let’s unplug the
cable to the host to see what happens:
SW1#
STP: VLAN0001 sent Topology Change Notice on Fa0/24
127 | P a g e
Spanning-tree will send a topology change notification on the interface towards SW2 and
the counter will increase:
In short, everytime we unplug the cable the switch will generate a TCN. Let’s see the
difference when we enable portfast…
2. Portfast enabled
All we have to do is enable portfast on the FastEthernet 0/1 interface that connects our
host:
We get a big warning that portfast shouldn’t be used on interfaces that connect to other
switches etc.
There is also a global command “spanning-tree portfast default” that will enable
portfast on all interfaces that are in access mode. The result will be the same, but it
saves you from enabling it on each interface separately.
Great, the interface skips the listening and learning state and goes to forwarding
immediately. Also, the switch will no longer generate topology change notifications when
you unplug this cable anymore.
Want to take a look for yourself? Here you will find the final configuration of SW1.
hostname SW1
!
interface FastEthernet0/1
spanning-tree portfast
128 | P a g e
!
end
Spanning-Tree UplinkFast
Uplinkfast is a spanning-tree feature that was created to improve the convergence time.
In this lesson we’ll take a look at how uplinkfast works. Here’s the topology that I will use
to demonstrate it:
Three switches and SW1 is our root bridge. The fa0/16 interface on SW3 has been
blocked. I’m only using VLAN 1 so nothing fancy here…
If we look at SW3 we see that the fa0/16 interface has been blocked and fa0/14 is the
root port. Let’s see what happens with this topology when one of the links fails:
129 | P a g e
When the fa0/14 interface on SW3 fails we’ll have to use fa0/16 to reach the root bridge.
How long does it take for SW3 to make the transition? Let’s find out:
BPDUs are originated from the root bridge so if we receive BPDUs on an interface the
switch knows it can reach the root bridge on this interface. We have to go through the
listening (15 seconds) and learning state (15 seconds) so it takes 30 seconds to end up
in the forwarding state.
The good thing is that spanning-tree solves the link failure automatically but it also
means that we have a downtime of 30 seconds. If you want you can tune the forward
delay timer to speed up this process down to roughly 14 seconds.
SW3(config)#interface fa0/14
SW3(config-if)#no shutdown
SW3(config)#spanning-tree uplinkfast
Now I’m going to enable spanning-tree uplinkfast. This is a global command, you can’t
configure it on the interface level.
SW3(config)#interface fa0/14
SW3(config-if)#shutdown
SW3# STP: VLAN0001 new root port Fa0/16, cost 3038
SW3# %SPANTREE_FAST-7-PORT_FWD_UPLINK: VLAN0001 FastEthernet0/16 moved to
Forwarding (UplinkFast).
Here’s the big difference. When uplinkfast is enabled a non-designated port will go to
forwarding state immediately if the root port fails. Instead of 30 seconds downtime
connectivity is restored immediately.
130 | P a g e
UplinkFast is useful but it will cause a problem with our MAC address tables. In the
picture above I added two computers to our topology. Interface fa0/16 on SW3 is the
non-designated port and fa0/14 is the root port. Take a look at the following topology:
Let me show you the MAC address tables for all switches:
131 | P a g e
H1: 000c.2928.5c6c
H2: 000c.29e2.03ba
When the link between SW1 and SW3 fails, SW3 will use the fa0/16 interface
immediately. However, it will take 15 seconds for the topology change mechanism to
age out the MAC address table!
Take a look again at the MAC address table for SW2. The MAC address
(000c.29e2.03ba) that I highlighted belongs to H2. When SW2 receives an Ethernet
Frame for H2 it will be forwarded to SW1 and it will be dropped! (Well at least for 15
seconds until the topology change mechanism kicks in…).
Of course, we have a solution to speed this up, here’s what we will do:
132 | P a g e
Once SW3 switches over to use its non-designated port it will create a dummy
multicast frame. The source MAC address of this Ethernet Frame will be all the MAC
addresses that it has in its MAC address table. In my example above this is only the
MAC address of H2. The destination multicast address is a proprietary Cisco MAC
address.
This multicast frame will be flooded to all other switches so they can update their MAC
address tables right away.
Spanning-tree has saved the day again…anything else you need to know? What do you
think will happen if I re-enable the fa0/14 interface on SW3 again (the original root port)?
SW3(config)#interface fa0/14
SW3(config-if)#no shutdown
Let’s bring the interface back up. In my lab it’s not as exciting as in the picture…
133 | P a g e
SW3# STP: VLAN0001 Fa0/14 -> listening
SW3# STP: VLAN0001 Fa0/14: root port delay timer active
SW3# STP: VLAN0001 Fa0/14 -> blocking
SW3# STP: VLAN0001 new root port Fa0/14, cost 3019
SW3# STP: VLAN0001 Fa0/16 -> blocking (uplinkfast)
You can see we don’t immediately switch back to interface fa0/14. There’s no reason to
switch back to this interface ASAP because we have a working root port. Even if we
would switch back to interface fa0/14 right away we’d still have to wait because the
fa0/17 interface on SW1 will have to go through the listening and learning state (which
takes 30 seconds).
Backbone Fast is used to recover from an indirect link failure. What does that mean?
Let me show you an example of an indirect link failure and how spanning-tree deals with
it:
Take a look at the picture above. SW1 is the root bridge and the fa0/16 interface on
SW3 has been blocked. Suddenly the link between SW1 and SW2 fails. From SW3’s
perspective this is an indirect link failure.
This is what will happen:
1. SW2 will detect this link failure immediately since it’s a directly connected link.
Since it doesn’t receive any BPDUs from the root anymore it assumes it is now
the new root bridge and will send BPDUs towards SW3 claiming to be the new
root.
134 | P a g e
2. SW3 will receive these BPDUs from SW2 but it will realize that this new BPDU
is inferior compared to the old one it has currently stored on its fa0/16 interface
and will ignore this new BPDU. When a switch receives an inferior BPDU it
means that the neighbor switch has lost its connection to the root bridge.
3. After 20 seconds (default timer) the max age timer will expire for the old BPDU on
the fa0/16 interface of SW3. The interface will go from blocking to the listening
state and will send BPDUs towards SW2.
4. SW2 will receive this BPDU from SW3 and discovers that he isn’t the root bridge.
It won’t send BPDUs anymore towards SW3.
5. The fa0/16 interface on SW3 will continue from the listening state (15 seconds) to
the learning state (15 seconds) and ends up in the forwarding state.
Connectivity is now restored but it took 20 seconds for the max age timer to expire, 15
seconds for the listening state and another 15 seconds for the learning state before we
go to the forwarding state. That’s a total of 50 seconds downtime. Let’s take a look at
this situation on our switches:
SW1(config)#interface fa0/14
SW1(config-if)#shutdown
SW3 receives the BPDUs from SW2 who claims to be the root bridge.
135 | P a g e
After the max age timer expires (20 seconds) for the old BPDU from SW2 the fa0/16
interface on SW3 will go to the listening and learning state and ends up in forwarding
state.
The identity crisis of SW2 comes to an end. It now hears the BPDUs from the root bridge
through SW3 and understands that it’s not the root bridge.
Without backbone fast, spanning-tree will discard the inferior BPDUs that SW3 receives
on its fa0/16 interface and it will have to wait till the max age timer expires (20 seconds).
If we enable backbone fast it will skip the max age timer so we can save 20 seconds of
time.
SW1(config)#interface fa0/14
SW1(config-if)#no shutdown
SW1(config)#spanning-tree backbonefast
SW2(config)#spanning-tree backbonefast
SW3(config)#spanning-tree backbonefast
Let’s enable backbone fast on all switches. This is a global command (spanning-tree
backbonefast).
Use the debug spanning-tree backbonefast detail command to see real-time information
on backbone fast.
SW1(config)#interface fa0/14
SW1(config-if)#shutdown
136 | P a g e
SW2# STP: VLAN0001 we are the spanning tree root
SW2 loses its connection to the root bridge and assumes he is now the new root bridge.
Nothing new so far…
SW1# STP FAST: VLAN0001 FastEthernet0/17: sending requested RLQ response PDU
SW1 receives a new packet called a (RLQ) Root Link Query from SW3. As soon as
SW3 receives an inferior BPDU it will send a root link query on its root port and non-
designated ports to check if the root bridge is still available.
SW3# STP FAST: received RLQ response PDU was expected on VLAN0001 FastEthernet0/14
- resp root id 4097-0011.bb0b.3600
SW3 receives a reply to its root link query on the fa0/14 interface to SW1.
Because SW3 received a response from the root bridge on its fa0/14 interface it can now
skip the max age timer on its f0/16 interface and the interface goes to the listening and
learning state right away. We effectively save 20 seconds (max age timer).
Take a good look at the last debug output from SW3. It doesn’t say that it received
something on the fa0/16 interface, it means that it received an answer to the root link
query that it did because it received an inferior BPDU on the fa0/16 interface. That’s all
there is to backbone fast, I hope you enjoyed this lesson.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname SW1
!
spanning-tree backbonefast
!
end
hostname SW2
!
spanning-tree backbonefast
!
end
137 | P a g e
hostname SW3
!
spanning-tree backbonefast
!
end
Nowadays we see more and more routing in our networks. Routing protocols like OSPF
and EIGRP are much faster than spanning-tree when they have to deal with changes in
the network. To keep up with the speed of these routing protocols another flavor of
spanning-tree was created…rapid spanning-tree.
Rapid spanning-tree is not a revolution of the original spanning-tree but an evolution.
Behind the scenes some things have been changed to speed up the process,
configuration-wise it’s the same as what you have seen so far. I will refer to the original
spanning-tree as “classic spanning-tree”.
Let’s dive into rapid spanning-tree and we’ll see what the differences are with the classic
spanning-tree.
Take a look at the picture below:
Remember the port states of spanning-tree? We have a blocking, listening, learning and
forwarding port state. This is the first difference between spanning-tree and rapid
spanning-tree. Rapid spanning-tree only has three port states:
Discarding
Learning
Forwarding
You already know about learning and forwarding but discarding is a new port state.
Basically, it combines the blocking and listening port state. Here’s a nice overview:
138 | P a g e
Blocking Discarding No No
Do you remember all the other port roles that spanning-tree has? Let’s do a little review
and I’ll show you what is different for rapid spanning-tree:
The switch with the best bridge ID (priority + MAC address) becomes the root bridge.
The other switches (non-root) have to find the shortest cost path to the root bridge. This
is the root port. There’s nothing new here, this works exactly the same for rapid
spanning-tree. The next step is to select the designated ports:
139 | P a g e
On each segment there can be only one designated port, or we’ll end up with a loop.
The port will become the designated port if it can send the best BPDU. SW1 as a root
bridge will always have the best ports so all of interfaces will be designated. The fa0/16
interface on SW2 will be the designated port in my example because it has a better
bridge ID than SW3. There’s still nothing new here compared to the classic spanning-
tree. The interfaces that are left will be blocked:
SW3 receives better BPDUs on its fa0/16 interface from SW2 and thus it will be blocked.
This is the alternate port and it’s still the same thing for rapid spanning-tree. Let me
show you a new example with a port state that is new for rapid spanning-tree:
Here is a new port for you, take a look at the fa0/17 interface of SW2. It’s called
a backup port and it’s new for rapid spanning-tree. You are very unlikely to see this port
on a production network though. Between SW2 and SW3 I’ve added a hub. Normally
(without the hub in between) both fa0/16 and fa0/17 would be designated ports.
140 | P a g e
Because of the hub the fa0/16 and fa0/17 interface on SW2 are now in the same
collision domain. Fa0/16 will be elected as the designated port and fa0/17 will become
the backup port for the fa0/16 interface. The reason that SW2 sees the fa0/17 interface
as a backup port is because it receives its own BPDUs on the fa0/16 and fa0/17
interfaces and understands that it has two connections to the same segment. If you
remove the hub the fa0/16 and fa0/17 will both be designated ports just like the classic
spanning-tree.
Something else that is different is the BPDU, take a look:
The BPDU is different for rapid spanning-tree. In the classic spanning-tree the flags field
only had two bits in use:
Topology change.
Topology change acknowledgment.
All bits of the flag field are now used. The role of the port that originates the BPDU will
be added by using the port role field, it has the following options:
Unknown
Alternate / Backup port.
Root port.
Designated port.
This new BPDU is called a version 2 BPDU. Switches running the old version of
spanning-tree will drop this new BPDU version. In case you are wondering…rapid
spanning-tree and the old spanning are compatible! Rapid spanning-tree has a way of
dealing with switches running the older spanning-tree version.
Let’s walk through the other stuff that has been changed:
BPDUs are now sent every hello time. Only the root bridge generated BPDUs in the
classic spanning-tree and those were relayed by the non-root switches if they received it
on their root port. Rapid spanning-tree works differently…all switches generate
BPDUs every two seconds (hello time). This is the default hello time, but you can
change it.
The classic spanning-tree uses a max age timer (20 seconds) for BPDUs before they
are discarded. Rapid spanning-tree works differently! BPDUs are now used as
a keepalive mechanism similar to what routing protocols like OSPF or EIGRP use. If a
switch misses three BPDUs from a neighbor switch it will assume connectivity to this
switch has been lost and it will remove all MAC addresses immediately.
Rapid spanning tree will accept inferior BPDUs. The classic spanning tree ignores
them. Does this ring a bell? This is pretty much the backbone fast feature of classic
spanning-tree.
141 | P a g e
Transition speed (convergence time) is the most important feature of rapid spanning
tree. The classic spanning tree had to walk through the listening and learning state
before it would move an interface to the forwarding state, this took 30 seconds with the
default timers. The classic spanning tree was based on timers.
Rapid spanning doesn’t use timers to decide whether an interface can move to the
forwarding state or not. It will use a negotiation mechanism for this. I’ll show you how
this works in a bit.
Do you remember portfast? If we enable portfast while running the classic spanning tree
it will skip the listening and learning state and put the interface in forwarding state right
away. Besides moving the interface to the forwarding state it will also not generate
topology changes when the interface goes up or down. We still use portfast for rapid
spanning-tree, but it’s now referred to as an edge port.
Rapid spanning tree can only put interfaces in the forwarding state really fast on edge
ports (portfast) or point-to-point interfaces. It will take a look at the link type and
there are only two link types:
Point-to-point (full duplex)
Shared (half duplex)
Normally we are using switches and all our interfaces are configured as full duplex, rapid
spanning tree sees these interfaces as point-to-point. If we introduce a hub to our
network we’ll have half duplex which is seen as a shared interface to rapid spanning-
tree.
Let’s take a close look at the negotiation mechanism that I described earlier:
Let me describe the rapid spanning tree synchronization mechanism by using the picture
above. SW1 on top is the root bridge. SW2, SW3 and SW4 are non-root bridges.
As soon as the link between SW1 and SW2 comes up their interfaces will be in blocking
mode. SW2 will receive a BPDU from SW1 and now a negotiation will take place
called sync:
142 | P a g e
After SW2 received the BPDU from the root bridge it immediately blocks all its non-
edge designated ports. Non-edge ports are the interfaces that connect to other
switches while edge ports are the interfaces that have portfast configured. As soon as
SW2 blocks its non-edge ports the link between SW1 and SW2 will go into forwarding
state. SW2 will now do the following:
SW2 will also perform a sync operation with both SW3 and SW4 so they can quickly
move to the forwarding state.
Are you following me so far? The lesson to learn here is that rapid spanning tree uses
this sync mechanism instead of the “timer-based” mechanism that the classic
spanning tree uses (listening > learning > forwarding). I’m going to show you what this
143 | P a g e
looks like on real switches in a bit. Let’s take a closer look at the sync mechanism, let’s
look at what happens exactly between SW1 and SW2:
At first the interfaces will be blocked until they receive a BPDU from each other. At this
moment SW2 will figure out that SW1 is the root bridge because it has the best BPDU
information. The sync mechanism will start because SW1 will set the proposal bit in the
flag field of the BPDU. When SW2 receives the proposal it has to do something with it:
SW2 will block all its non-edge interfaces and will start the synchronization towards SW3
and SW4, once this is done SW2 will let SW1 know about this:
Once SW2 has its interfaces in sync mode it will let SW1 know about this by sending
an agreement. This agreement is a copy of the proposal BPDU where the proposal bit
has been switched off and the agreement bit is switched on. The fa0/14 interface on
SW2 will now go into forwarding mode. When SW1 receives the agreement here’s what
happens:
144 | P a g e
Once SW1 receives the agreement from SW2 it will put its fa0/14 interface in forwarding
mode immediately.
What about the fa0/16 and fa0/19 interface on SW2?
The exact same sync mechanism will take place now on these interfaces. SW2 will send
a proposal on its fa0/16 and fa0/19 interfaces towards SW3 and SW4. SW3 and SW4
will send an agreement:
145 | P a g e
SW3 and SW4 don’t have any other interfaces so they will send an agreement back to
SW2:
SW2 will place its fa0/16 and fa0/19 interface in forwarding and we are done. This sync
mechanism is just a couple of messages flying back and forth and very fast, it’s much
faster than the timer-based mechanism of the classic spanning tree!
What else is new with rapid spanning tree? There are three more things I want to show
you:
UplinkFast
Topology change mechanism.
Compatibility with classic spanning tree.
146 | P a g e
When you configure the classic spanning tree you have to enable UplinkFast yourself.
Rapid spanning tree uses UpLinkFast by default, you don’t have to configure it yourself.
When a switch loses its root port it will put its alternate port in forwarding immediately.
The difference is that the classic spanning tree needed multicast frames to update the
MAC address tables of all switches.
We don’t need this anymore because the topology change mechanism for rapid
spanning tree is different. So what’s different about the topology change mechanism?
With the classic spanning tree a link failure would trigger a topology change. Using rapid
spanning tree a link failure is not considered as a topology change. Only non-edge
interfaces (leading to other switches) that move to the forwarding state are considered
as a topology change. Once a switch detects a topology change this will happen:
It will start a topology change while timer with a value that is twice the hello
time. This will be done for all non-edge designated and root ports.
It will flush the MAC addresses that are learned on these ports.
As long as the topology change while timer is active it will set the topology
change bit on BPDUs that are sent out these ports. BPDUs will also be sent out
of its root port.
When a neighbor switch receives this BPDU with the topology change bit set this will
happen:
It will clear all its MAC addresses on all interfaces except the one where it
received the BPDU with the topology change on.
It will start a topology change while timer itself and send BPDUs on all designated
ports and the root port, setting the topology change bit.
Instead of sending a topology change all the way up to the root bridge like the classic
spanning tree does, the topology change is now quickly flooded throughout the network.
If you want to know exactly how this topology change mechanism works then take a look
at this lesson.
147 | P a g e
Last but not least, let’s talk about compatibility. The short answer is that rapid spanning
tree and classic spanning tree are compatible. However when a switch running rapid
spanning tree communicates with a switch running classic spanning tree all the Speedy
Gonzales features won’t work!
In the example above I have my three switches. Between SW1 and SW2 we will run
rapid spanning tree. Between SW2 and SW3 we will fall back to the classic spanning
tree.
Seen enough theory? In the next lesson I will show you the configuration and the
debugs of everything that you have learned so far.
In a previous lesson I explained the differences between classic and rapid spanning-tree
and how rapid spanning-tree works. If you haven’t seen it before, I would recommend
to look at it first before diving in the configuration.
Having said that, let’s look at the configuration. This is the topology that I will use:
148 | P a g e
This is the topology I’m going to use. SW1 will be the root bridge in my example. First we
have to enable rapid spanning-tree:
That’s it…just one command will enable rapid spanning tree on our switches. The
implementation of rapid spanning tree is rapid-pvst. We are calculating a rapid
spanning tree for each VLAN.
First I want to show you the sync mechanism:
SW1(config)#interface fa0/14
SW1(config-if)#shutdown
SW1(config)#interface f0/17
SW1(config-if)#shutdown
149 | P a g e
Spanning Tree event debugging is on
SW1(config)#interface fa0/14
SW1(config-if)#no shutdown
I’m going to bring the fa0/14 interface back to the land of the living on SW1. Here’s what
we see:
SW1#
setting bridge id (which=3) prio 4097 prio cfg 4096 sysid 1 (on) id
1001.0011.bb0b.3600
RSTP(1): initializing port Fa0/14
RSTP(1): Fa0/14 is now designated
RSTP(1): transmitting a proposal on Fa0/14
The fa0/14 interface on SW1 will be blocked and it’ll send a proposal to SW2.
SW2#
RSTP(1): initializing port Fa0/14
RSTP(1): Fa0/14 is now designated
RSTP(1): transmitting a proposal on Fa0/14
RSTP(1): updt roles, received superior bpdu on Fa0/14
RSTP(1): Fa0/14 is now root port
Apparently SW2 thought it was the root bridge because it says it received a superior
BPDU on its fa0/14 interface. It changes its fa0/14 interface to root port.
The fa0/16 interface on SW2 will go into sync mode. This is the interface that connects
to SW3.
150 | P a g e
%LINK-3-UPDOWN: Interface FastEthernet0/14, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/14, changed state to
up
SW1 receives the agreement from SW2 and interface fa0/14 will go into forwarding.
SW2 receives the agreement from SW3 and the interface will go into forwarding. That’s
all there to is it…a quick number of handshakes and the interfaces will move to
forwarding without the use of any timers. Let’s continue!
SW1(config)#interface fa0/17
SW1(config-if)#no shutdown
I’m going to enable this interface so that connectivity is fully restored. Let’s look at an
overview:
SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 0011.bb0b.3600
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
151 | P a g e
Aging Time 300
We can verify that SW1 is the root bridge. This show command also reveals that we are
running rapid spanning tree. Note that the link type is p2p. This is because my
FastEthernet interfaces are in full duplex by default. Let’s run the same command on the
other two switches:
SW2#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 0011.bb0b.3600
Cost 19
Port 16 (FastEthernet0/14)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
SW3#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address 0011.bb0b.3600
Cost 19
Port 14 (FastEthernet0/14)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
152 | P a g e
---------------- ---- --- --------- -------- --------------------------------
Fa0/14 Root FWD 19 128.14 P2p
Fa0/16 Altn BLK 19 128.16 P2p
Here are SW2 and SW3. Nothing new here, it’s the same information as classic
spanning tree. Here’s what the topology looks like now:
Let’s add another link between SW2 and SW3 to see if this influences our topology:
153 | P a g e
Fa0/17 Desg FWD 19 128.19 P2p
Nothing spectacular, we just have another designated port on SW2 and another
alternate port on SW3. Let me add that alternate port to the topology:
So far the topology with rapid spanning-tree looks the same as with classic spanning-
tree. Now let me show you something you haven’t seen before. I will add a hub between
SW2 and SW3:
154 | P a g e
Now take a look again at the interfaces:
Here’s something new. SW2 has a backup port. Because of the hub in the middle SW2
and SW3 will hear their own BPDUs.
You can also see that the link type is shr (shared). That’s because the hub causes
these switches to switch their interfaces to half duplex. Here’s the topology picture again:
You probably won’t ever see the backup port on a production network since hubs are
scarce now but if you see it, you’ll know why…
BPDUs are sent every two seconds (hello time) and if you want to prove this you can
take a look at a debug:
155 | P a g e
SW2#debug spanning-tree bpdu
You can use the debug spanning-tree bpdu command to view BPDUs are sent or
received.
SW2#
STP: VLAN0001 rx BPDU: config protocol = rstp, packet from FastEthernet0/14 ,
linktype IEEE_SPANNING , enctype 2, encsize 17
STP: enc 01 80 C2 00 00 00 00 11 BB 0B 36 10 00 27 42 42 03
STP: Data
000002023C10010011BB0B36000000000010010011BB0B360080100000140002000F00
STP: VLAN0001 Fa0/14:0000 02 02 3C 10010011BB0B3600 00000000 10010011BB0B3600 8010
0000 1400 0200 0F00
RSTP(1): Fa0/14 repeated msg
RSTP(1): Fa0/14 rcvd info remaining 6
RSTP(1): sending BPDU out Fa0/16
RSTP(1): sending BPDU out Fa0/17
STP: VLAN0001 rx BPDU: config protocol = rstp, packet f
You will see the contents of the BPDU like above. It’s not very useful if you want to see
the content of the BPDU but it does show us that SW2 is receiving BPDUs and sending
them on its interfaces.
If you do want to look at the contents of a BPDU I recommend you to use wireshark. It
shows everything in a nice structured way.
You don’t have to capture a BPDU yourself if you don’t feel like. The wireshark website
has many pre-recorded packet captures.
Let’s get rid of the hub and do something else…I’m going to simulate a link failure
between SW1 and SW3 to see how rapid spanning tree deals with this.
156 | P a g e
SW1(config)#interface fa0/17
SW1(config-if)#shutdown
SW3#
RSTP(1): updt rolesroot port Fa0/14 is going down
RSTP(1): Fa0/16 is now root port
SW3 realized something is wrong with the root port almost immediately and will change
the fa0/16 interface from alternate port to root port. This is the equivalent of UplinkFast
for classic spanning-tree, but it’s enabled by default for rapid spanning tree.
SW1(config)#interface fa0/17
SW1(config-if)#no shutdown
157 | P a g e
Let’s simulate an indirect link failure. The classic spanning-tree has backbone fast and a
similar mechanism is enabled by default for rapid spanning tree.
SW1(config)#interface fa0/14
SW1(config-if)#shutdown
Shutting down this interface will simulate an indirect link failure for SW3.
SW2#
RSTP(1): updt roles, root port Fa0/14 going down
RSTP(1): we become the root bridge
RSTP(1): updt roles, received superior bpdu on Fa0/16
RSTP(1): Fa0/16 is now root port
SW3#
03:41:29: RSTP(1): updt rolessuperior bpdu on Fa0/16 (synced=0)
03:41:29: RSTP(1): Fa0/16 is now designated
SW2 believes it’s the root bridge until it receives a superior BPDU from SW3. This
happens within the blink of an eye.
SW1(config)#interface fa0/14
SW1(config-if)#no shutdown
Let’s get rid of the shutdown command and continue…let’s look at the edge ports:
158 | P a g e
I added H1 and it’s connected to the fa0/2 interface of SW2. Let’s see how rapid
spanning tree deals with interfaces connected to other devices:
SW2(config)#interface fa0/2
SW2(config-if)#no shutdown
RSTP(1): initializing port Fa0/2
RSTP(1): Fa0/2 is now designated
RSTP(1): transmitting a proposal on Fa0/2
%LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to up
RSTP(1): transmitting a proposal on Fa0/2
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to
up
RSTP(1): transmitting a proposal on Fa0/2
RSTP(1): transmitting a proposal on Fa0/2
RSTP(1): transmitting a proposal on Fa0/2
RSTP(1): transmitting a proposal on Fa0/2
RSTP(1): transmitting a proposal on Fa0/2
RSTP(1): transmitting a proposal on Fa0/2
RSTP(1): transmitting a proposal on Fa0/2
RSTP(1): Fa0/2 fdwhile Expired
You see that it sends a bunch of proposals from the sync mechanism towards the
computer. After a while they will expire. The port will end up in forwarding state anyway,
but it takes a while.
SW2(config-if)#spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
159 | P a g e
Use with CAUTION
You have to tell rapid spanning tree that the interface connecting the computer is an
edge port. The word “edge” makes sense; it’s the border of our spanning tree topology.
Enable portfast and you are ready to go.
SW2(config)#interface fa0/2
SW2(config-if)#shutdown
SW2(config-if)#no shutdown
SW2#
RSTP(1): initializing port Fa0/2
RSTP(1): Fa0/2 is now designated
*Mar 1 04:08:32.931: %LINK-3-UPDOWN: Interface FastEthernet0/2, changed state to
up
The interface will go to forwarding immediately. Our switch knows that this is the edge of
the spanning tree and we don’t have to send proposals to it. The last thing we have to
look at is compatibility…
I’m going to change SW2 to PVST mode. SW1 and SW3 will remain at rapid-PVST:
SW2(config)#
RSTP(1): updt roles, non-tracked event
setting bridge id (which=3) prio 8193 prio cfg 8192 sysid 1 (on) id
2001.0019.569d.5700
set portid: VLAN0001 Fa0/2: new port id 8004
STP: VLAN0001 Fa0/2 ->jump to forwarding from blocking
set portid: VLAN0001 Fa0/14: new port id 8010
STP: VLAN0001 Fa0/14 -> listening
set portid: VLAN0001 Fa0/16: new port id 8012
STP: VLAN0001 Fa0/16 -> listening^Z
STP: VLAN0001 heard root 4097-0011.bb0b.3600 on Fa0/16 supersedes 8193-
0019.569d.5700
STP: VLAN0001 new root is 4097, 0011.bb0b.3600 on port Fa0/16, cost 38
160 | P a g e
STP: VLAN0001 new root port Fa0/14, cost 19
STP: VLAN0001 Fa0/14 -> learning
STP: VLAN0001 Fa0/16 -> learning
STP: VLAN0001 sent Topology Change Notice on Fa0/14
STP: VLAN0001 Fa0/14 -> forwarding
STP: VLAN0001 Fa0/16 -> forwarding
SW2 will throw some information at you. You can see that it receives BPDUs from the
root bridge and that the interfaces will have to go through the listening and learning
state. When the switches that are talking rapid spanning-tree receive a BPDU from the
classic spanning tree they will generate classic spanning tree BPDUs themselves, so
everything keeps working.
We can verify this by looking at the interfaces again. All switches still agree on the port
states and everything will function as it should be!
That’s all there is about rapid spanning-tree. The configuration is pretty simple, but I
hope the debugs and show commands helped to understand exactly how everything
works.
Multiple Spanning Tree (MST)
By default, Cisco Catalyst Switches run PVST+ or Rapid PVST+ (Per VLAN Spanning
Tree). This means that each VLAN is mapped to a single spanning tree instance. When
you have 20 VLANs, it means there are 20 instances of spanning tree.
Is this a problem? Like always…it depends, let’s take a look at an example:
161 | P a g e
Take a look at the topology above. We have three switches and a lot of VLANs. There’s
199 VLANs in total. If we are running PVST or Rapid PVST this means that we have 199
different calculations for each VLAN. This requires a lot of CPU power and memory.
When SW2 is the root bridge for VLAN 100 – 200 and SW3 for VLAN 201 – 300 our
spanning-tree topologies will look like this:
SW2 is the root bridge for VLAN 100 up to VLAN 200. This means that the fa0/17
interface of SW1 or the fa0/14 interface on SW3 will be blocked. I’ll have 100 spanning
tree calculations, but they all look the same for these VLANs…
The same thing applies for VLAN 201 – 300. SW3 is the root bridge for VLAN 201 up to
300. The fa0/14 interface on SW1 or SW2 will be blocked for all these VLANs.
Two different outcomes but I still have 200 different instances of spanning tree running.
That’s a waste of CPU cycles and memory right?
MST (Multiple Spanning Tree) will solve this issue. Instead of calculating a spanning tree
for each VLAN we can use instances and map VLANS to each instance. For the
network above I could do something like this:
Instance 1: VLAN 100 – 200
Instance 2: VLAN 201 – 300
Sounds logical right? Only two spanning tree calculations (instances) are required for all
these VLANs.
162 | P a g e
MST works with the concept of regions. Switches that are configured to use MST need
to find out if their neighbors are running MST.
When switches have the same attributes they will be in the same region. It’s possible to
have one or more regions and here are the attributes that need to match:
MST configuration name.
MST configuration revision number.
MST instance to VLAN mapping table.
When switches have the same attributes configured they will be in the same region. If
the attributes are not the same the switch is seen as being at the boundary of the region.
It can be connected to another MST region but also talk to a switch running another
version of spanning tree.
The MST configuration name is just something you can make up, it’s used to identify
the MST region. The MST configuration revision number is also something you can
make up and the idea behind this number is that you can change the number whenever
you change your configuration. It doesn’t matter what you pick as long as it’s the same
on all switches within the MST region. VLANs will be mapped to an instance by using
the MST instance to VLAN mapping table. This is something we have to do ourselves.
Within the MST region, we will have one instance of spanning tree that will create a loop-
free topology within the region. When you configure MST there is always one default
instance used to calculate the topology within the region. We call this the IST (Internal
Spanning Tree). By default, Cisco will use instance 0 to run the IST. In case you were
wondering…its rapid spanning tree that we run within the MST.
163 | P a g e
I could create instance 1 for VLAN 100 – 200 and instance 2 for VLAN 201 – 300.
Depending on which switch will become root bridge for each instance a different port
will be blocked. It could look like this:
The switch outside the MST region doesn’t see what the MST region looks like. For
this switch it’s like it’s talking to one big switch or a ‘black box’:
164 | P a g e
If you want to know the details of how MST and PVST+ work together, check out
our MST and PVST+ interoperability lesson. Let’s have some fun with the
configuration.
1. MST Configuration
I will use the following topology:
We’ll start with a single MST region with the following attributes:
MST configuration name: “Networklessons”
MST configuration revision number: 1 (this is just a number that I made up)
MST instance to VLAN mapping table:
o Instance 2: VLAN 10, 20 and 30.
o Instance 3: VLAN 40, 50 and 60.
This is what we will do:
This is how we enable MST on our switches. Let’s look at the default MST instance:
165 | P a g e
Name []
Revision 0 Instances configured 1
You can also use the show spanning-tree mst command. We can see the VLAN
mapping but also information about the root bridge. Before we can add more instances
we have to do our chores…time to add some VLANs and configure the links between
the switches as trunks:
SW1(config)#interface fa0/14
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
166 | P a g e
SW1(config)#interface fa0/17
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW2(config)#interface fa0/14
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config)#interface fa0/16
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW3(config)#interface fa0/14
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
SW3(config)#interface fa0/16
SW3(config-if)#switchport trunk encapsulation dot1q
SW3(config-if)#switchport mode trunk
That takes cares of the trunks, and here are the VLANs:
SW1, SW2 & SW3:
(config)#vlan 10
(config-vlan)#vlan 20
(config-vlan)#vlan 30
(config-vlan)#vlan 40
(config-vlan)#vlan 50
(config-vlan)#vlan 60
(config-vlan)#exit
167 | P a g e
SW3(config-mst)#revision 1
SW3(config-mst)#instance 2 vlan 10,20,30
SW3(config-mst)#instance 3 vlan 40,50,60
SW3(config-mst)#exit
We can use the show spanning-tree mst configuration command to verify our
configuration. You can see that we now have two instances. The VLANS are mapped to
instance 2 and 3. All the other VLANs are still mapped to instance 0.
So far so good, let’s play some more with MST and change the root bridge:
Within our region I want to make sure that SW1 is the root bridge. We’ll have to change
the priority for the IST (Internal Spanning Tree):
168 | P a g e
SW1(config)#spanning-tree mst 0 priority 4096
Here you can see that SW1 is the root bridge for the IST. It says CIST which stands for
Common and Internal Spanning Tree.
Let’s take a look at the interfaces:
Now we know the state of all interfaces. Let’s draw a picture so we know what the IST
looks like:
169 | P a g e
Now I want to make some changes to instance 2 so SW2 will be root bridge:
This command proves that SW2 is the root bridge for instance 2. Let’s check the
interfaces:
170 | P a g e
---------------- ---- --- --------- -------- --------------------------------
Fa0/14 Desg FWD 200000 128.14 P2p
Fa0/16 Root FWD 200000 128.16 P2p
This is what instance 2 looks like. Let’s turn that into a nice picture:
Here’s a fancy picture of instance 2 to show you the port roles. Note that this topology
looks different than the one for instance 0.
Last but not least I’m now going to make some changes for instance 3:
SW3 is now the root bridge for instance 3. Let’s look at the interfaces:
171 | P a g e
Fa0/17 Root FWD 200000 128.19 P2p
172 | P a g e
On the left side you see instance 2 and on the right side is instance 3.
By changing the root bridge per instance we end up with different topologies:
Instance 2: fa0/17 on SW1 is blocked for VLAN 10, 20 and 30.
Instance 3: fa0/14 on SW2 is blocked for VLAN 40, 50 and 60.
Is this making sense so far? I sure hope so!
What happens when I add another switch that is running PVST to our topology? Let’s
find out!
PVST is the default on most Cisco switches but I’m showing it here, so you really know
I’m running PVST.
SW4(config)#interface fa0/16
SW4(config-if)#switchport trunk encapsulation dot1q
SW4(config-if)#switchport mode trunk
SW4(config)#interface fa0/19
SW4(config-if)#switchport trunk encapsulation dot1q
SW4(config-if)#switchport mode trunk
SW4(config)#vlan 10
SW4(config-vlan)#vlan 20
SW4(config-vlan)#vlan 30
SW4(config-vlan)#vlan 40
SW4(config-vlan)#vlan 50
SW4(config-vlan)#vlan 60
SW4(config-vlan)#exit
173 | P a g e
I want to make sure that we have trunk to SW2 and SW3 and that SW4 knows about all
the VLANs. Let’s see what SW4 thinks of all this:
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 4096
Address 0011.bb0b.3600
Cost 19
Port 19 (FastEthernet0/19)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
This is what SW4 sees about VLAN 1. Keep in mind this VLAN was mapped to instance
0. It sees SW1 as the root bridge and you can see which port is in forwarding and
blocking mode.
VLAN0010
Spanning tree enabled protocol ieee
Root ID Priority 4096
Address 0011.bb0b.3600
Cost 19
Port 19 (FastEthernet0/19)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
174 | P a g e
Here’s VLAN 10 which is mapped to instance 2. SW4 sees SW1 as the root bridge for
this VLAN even though we configured SW2 as the root bridge for instance 2. This is
perfectly normal because MST will only advertise BPDUs from the IST to the outside
world. We won’t see any information from instance 2 or instance 3 on SW4.
SW4#show spanning-tree vlan 40
VLAN0040
Spanning tree enabled protocol ieee
Root ID Priority 4096
Address 0011.bb0b.3600
Cost 19
Port 19 (FastEthernet0/19)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
VLAN 40 is mapped to instance 3 but you can see that SW4 sees SW1 as the root
bridge. SW4 receives the same BPDU for all VLANS.
MST (Multiple Spanning Tree) and PVST+ (Per VLAN Spanning Tree) both offer loop-
free layer two topologies but they each use a different approach:
MST maps multiple VLANs to an instance, reducing the number of spanning-tree
instances.
PVST+ calculates an instance for each spanning-tree instance.
The two versions are compatible but how should the two behave on the link that
connects the two spanning-tree protocols?
PVST+ sends BPDUs for each instance/VLAN so you could let MST process each
BPDU separately with the instance that is configured for the VLAN. MST, however,
doesn’t have an instance for each VLAN so what kind of BPDUs should it send?
This is an issue…it is possible that two VLANs share the same MST instance but use
different root bridges, root ports, and other attributes in the PVST+ domain. Which
information should MST send in its BPDUs? There is no way to create a 1:1 mapping
between the MST and PVST+ information.
Instead, when an MST region is connected to a PVST+ topology, MST is going
to simulate PVST+ with a feature called the PVST simulation mechanism. What it
does, is that the MST region will send PVST+ BPDUs (one for each VLAN) on the
175 | P a g e
interfaces that are connected to PVST+ switches. These BPDUs all carry the same
information and advertise the same root bridge. The interfaces that connect to the
PVST+ topology are called boundary interfaces/ports.
I’m talking about PVST+, but PVRST+ is also supported. However, MST only uses
PVST+ features, so there is no performance difference.
Since PVST+ switches now receive BPDUs for each VLAN from MST carrying the same
information, they will all make the same decisions when selecting a root bridge, root port,
etc.
Where does the information that MST advertises in the simulated PVST+ BPDUs come
from? All MST switches have to agree on the same information, so we use
the information from the IST for this. The root bridge in the MST region that is
elected as the root bridge for the IST, will also be used in the PVST+ BPDUs that
PVST simulation uses.
What about the other way around? From PVST+ to MST?
MST decides the port role (root, designated, non-designated) for the boundary
interface for all VLANs only by looking at the information in the VLAN 1 BPDU.
Deciding the port role on the boundary interface for all VLANs is risky…after all, it means
that we assume that all VLANs use the same root bridge, root ports, etc. We don’t know
if the PVST+ domain agrees on the port role for all VLANs that we select on our MST
boundary interface. There are, however, some simple checks that MST can use to figure
out if PVST+ agrees on the port roles. Let’s take a look at each possible port role.
Designated Port
If MST wants to use the boundary as a designated port. It uses the following check:
MST BPDU from IST must be superior compared to each PVST+ BPDU from every VLAN
that you receive on the boundary interface.
So, MST compares its own IST BPDU to all PVST+ BPDUs (one for each VLAN). If its
own BPDU is superior, it knows that PVST+ agrees on the port role and we can safely
turn the boundary interface into a designated port. If not, we know that PVST+ doesn’t
agree on our port role and we block our boundary interface. The status of the interface
shows up as broken.
Root Port
The boundary interface can become a root port if the VLAN 1 BPDU that it receives is
the best BPDU that it receives on any of its boundary interfaces. This means, that the
root bridge for VLAN 1 is located in the PVST+ domain. When this happens, the
interface will go into the forwarding state for all VLANs. This is a tricky situation. MST
acts as if all VLANs have their root bridge in the PVST+ domain and turns its boundary
interface as the root port for all VLANs, but that might not be the case. To counter this,
MST uses the following check:
PVST+ BPDUs for all VLANs except VLAN 1 must be identical or superior compared to
the PVST+ VLAN 1 BPDU.
176 | P a g e
What this means is that MST listens to all PVST+ BPDUs that it receives on its boundary
interface and checks if those BPDUs are superior compared to the VLAN 1 BPDU from
PVST+. If so, MST can safely turn its boundary interface into a root port. If not, the
switch reports an inconsistency error; the interface will be blocked and shows the broken
state.
One caveat here is that PVST+ uses the system ID extension, which uses the VLAN
number as part of the bridge ID. This makes it impossible to have PVST+ BPDUs from
different VLANs with an identical value. Because of this, PVST+ BPDUs require a
priority that is at least 4096 lower than the PVST+ VLAN 1 BPDU.
Non-designated Port
Last but not least, the boundary interface could be a non-designated port. It becomes a
non-designated port if the boundary interface receives a VLAN 1 PVST+ BPDU that is
superior to its own MST IST BPDU but not good enough to become a root port. In this
case, the boundary interface becomes a non-designated port for all VLANs. MST has to
check if the PVST+ domain also thinks this should be a non-designated port and it can
quickly check this by listening to all PVST+ BPDUs. When the PVST+ BPDUs are
superior to its own BPDU, it can become a non-designated port. Cisco switches don’t do
any additional checks. Even if a superior BPDU was received, it would report a PVST
inconsistency error and the port would go into broken mode, but since it’s blocked
anyway, it doesn’t matter.
It is easiest to configure your network so that the MST region is the root bridge in your
network. If your PVST+ domain has the root bridge, then MST will use the same root
port for all VLANs. If the root bridge is in your MST region, then you change the cost per
VLAN on your PVST+ switches to use different root ports and use a bit of load
balancing.
1. Configuration
Let’s take a look at all of this in action. There are three switches I use:
177 | P a g e
(config-if-range)#switchport trunk encapsulation dot1q
(config-if-range)#switchport mode trunk
SW1 is running rapid spanning-tree with its default priority. Let’s see what happens now
when I try to make SW1 the new root bridge for one VLAN:
As soon as you do this, this message will show up on SW2 and SW3:
178 | P a g e
SW2#
%SPANTREE-2-PVSTSIM_FAIL: Blocking designated port Gi0/1: Inconsistent inferior
PVST BPDU received on VLAN 60, claiming root 4106:fa16.3ec0.f43a
SW3#
%SPANTREE-2-PVSTSIM_FAIL: Blocking designated port Gi0/1: Inconsistent inferior
PVST BPDU received on VLAN 60, claiming root 4106:fa16.3ec0.f43a
In order for the boundary interface to be a designated port, the MST IST BPDU must be
superior compared to all PVST+ BPDUs which is not the case now. As a result, the
boundary interface is now in the broken state:
179 | P a g e
The GigabitEthernet 0/1 interface goes into the BKN (broken) status for all
instances/VLANs. In the last output, you can see that even though GigabitEthernet 0/1 is
in the broken state, SW2 does recognize SW1 as the root bridge. Let’s increase the
priority of SW1 so that SW2 and SW3 do become the root bridges in this topology.
SW2#
%SPANTREE-2-PVSTSIM_OK: PVST Simulation inconsistency cleared on port
GigabitEthernet0/1.
SW3#
%SPANTREE-2-PVSTSIM_OK: PVST Simulation inconsistency cleared on port
GigabitEthernet0/1.
SW1 now sees the MST region as the root bridge. Since all PVST+ BPDUs that SW2
and SW3 receive are inferior compared to the MST IST BPDU, the inconsistency is
cleared.
Everything is working correctly now. Let’s take a look at some of the spanning-tree
outputs. Here’s VLAN 1 that is mapped to instance 0 where SW2 is the root bridge:
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 8192
Address fa16.3e9f.1dac
Cost 4
Port 2 (GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Above we see that GigabitEthernet 0/1 is the root port. Here’s the output of VLAN 10
which is mapped to instance 1 with SW2 as the root bridge:
180 | P a g e
SW1#show spanning-tree vlan 10
VLAN0010
Spanning tree enabled protocol rstp
Root ID Priority 8192
Address fa16.3e9f.1dac
Cost 4
Port 2 (GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
The output is the same as VLAN 1. Let’s also take a look at VLAN 60 which is mapped
to instance 2 where SW3 is the root bridge:
VLAN0040
Spanning tree enabled protocol rstp
Root ID Priority 8192
Address fa16.3e9f.1dac
Cost 4
Port 2 (GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
The output above is interesting to see. As explained earlier, MST maps all VLANs to the
IST, so even VLAN 60 (and 40+50) share the same information, even though SW3 is the
root bridge for these VLANs. SW1 sees SW2 as the root bridge for these VLANs.
181 | P a g e
Having the MST region as the root bridge is a best practice. It’s simple to maintain, and it
allows load balancing. For example, let’s say we want the PVST+ domain to use another
root port for VLAN 60. We can achieve this by playing with the cost:
SW1 now uses GigabitEthernet 0/2 as its root port to reach VLAN 60:
VLAN0040
Spanning tree enabled protocol rstp
Root ID Priority 8192
Address fa16.3e9f.1dac
Cost 1
Port 3 (GigabitEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
GigabitEthernet 0/2 is now the root port for VLAN 60. All other VLANs still use
GigabitEthernet 0/1 as their root port.
Once I change the priority for VLAN 1 on SW1, SW2 starts complaining:
SW2#
%SPANTREE-2-PVSTSIM_FAIL: Blocking root port Gi0/1: Inconsistent
inferior PVST BPDU received on VLAN 10, claiming root
32778:fa16.3ec0.f43a
182 | P a g e
This is because of the root port check that MST does. To become a root port, all PVST+
BPDUs except for VLAN 1 need to be identical or superior compared to the PVST+
VLAN 1 BPDU. That’s not the case here, since VLAN 10-60 still have a default priority of
32768. Right now, SW2 puts its boundary interface in the broken state:
To fix this, we have to lower the priority on all VLANs of SW1, except for VLAN 1:
183 | P a g e
SW2#
%SPANTREE-2-PVSTSIM_OK: PVST Simulation inconsistency cleared on port
GigabitEthernet0/1
Above you can see that the boundary interface is now in the forwarding state for all
VLANs.
2. Conclusion
In this lesson, you have learned how MST and PVST+ (or PVRST+) are compatible.
184 | P a g e
MST and PV(R)ST+ are compatible, but it’s not very straightforward since you can’t
convert their information 1:1. To work around this, MST uses PVST+ compatibility mode
and sends a BPDU for each VLAN on its link (boundary interface) to the PVST+ domain.
The information in each BPDU is based on the IST.
MST uses the information from the PVST+ VLAN 1 BPDU to decide the role of the
boundary interface (root, designated or non-designated) for all VLANs. This introduces a
problem since the PVST+ domain might not agree on the port role. To work around this,
MST has a couple of checks:
Designated port:
o MST BPDU from IST must be superior compared to each
PVST+ BPDU from every VLAN
that you receive on the boundary interface.
Root port:
o PVST+ BPDUs for all VLANs except VLAN 1 must be identical or super
ior compared to the PVST+ VLAN 1 BPDU.
o Because of the extended system ID, it’s impossible to have a BPDU with
the same value. This means the priority of all non-VLAN 1 BPDUs has to
be at least 4096 lower than the PVST+ VLAN 1 BPDU.
Spanning-Tree BPDUGuard
Spanning-tree BPDUguard is one of the features that helps you protect your spanning-
tree topology. Let me give you an example:
185 | P a g e
switches will believe that the root bridge can now be reached through SW2 and we’ll
have a spanning tree re-calculation. Doesn’t sound like a good idea right? Here’s what
could go wrong:
You could even do a man in the middle attack without anyone knowing. Imagine I
connect my computer to two switches. If I become the root bridge all traffic from SW1 or
SW3 towards SW2 will flow through me. I’ll run Wireshark and wait till the magic
happens.
We can use BPDUGuard to prevent this from happening as it will block BPDUs:
BPDUguard will ensure that when we receive a BPDU on an interface that the interface
will go into err-disable mode.
Let’s take a look how to configure this…
1. Configuration
I will use the following topology:
186 | P a g e
To demonstrate BPDUguard I’m going to use two switches. I’ll configure the fa0/16
interface of SW2 so it will go into err-disable mode if it receives a BPDU from SW3.
SW2(config)#interface fa0/16
SW2(config-if)#spanning-tree bpduguard enable
This is how you enable it on the interface. Keep in mind normally you will never do this
between switches; you should configure this on the interfaces in access mode that
connect to computers.
SW2#
%SPANTREE-2-BLOCK_BPDUGUARD: Received BPDU on port Fa0/16 with BPDU Guard enabled.
Disabling port.
%PM-4-ERR_DISABLE: bpduguard error detected on Fa0/16, putting Fa0/16 in err-
disable state
: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/16, changed state
to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan1, changed state to down
*Mar 1 00:19:32.089: %LINK-3-UPDOWN: Interface FastEthernet0/16, changed state to
down
Get rid of BPDUguard and do a shut/no shut to get the interface back up and running.
You can also use the spanning-tree portfast bpduguard default command. This will
globally activate BPDUguard on all interfaces that have portfast enabled.
187 | P a g e
Portfast can also be enabled globally for all interfaces running in access mode.
Here’s a useful command so you can verify your configuration. You can see that portfast
and BPDUGuard have been enabled globally.
Spanning-Tree BPDUFilter
188 | P a g e
SW2(config)#interface fa0/16
SW2(config-if)#spanning-tree portfast trunk
SW2(config-if)#spanning-tree bpdufilter enable
It will stop sending BPDUs and it will ignore whatever is received. Let’s enable a debug
to see what it does:
You won’t see any exciting messages but if you enable BPDU debugging you’ll notice
that it doesn’t send any BPDUs anymore. If you want, you can also enable BPDU
debugging on SW3 and you’ll see that you won’t receive any from SW2.
SW2(config)#interface fa0/16
SW2(config-if)#no spanning-tree bpdufilter enable
Let’s get rid of the BPDUfilter command on the interface level and enable it globally:
You can also use the global command for BPDUfilter. This will enable BPDUfilter on all
interfaces that have portfast.
That’s all there is to it. Personally, I wouldn’t use this and use BPDUguard instead. If you
don’t expect BPDUs on an interface, then it’s better to get a notification (through err-
disable) then not seeing what is going on…
If you ever used fiber cables you might have noticed that there is a different connector to
transmit and receive traffic.
If one of the cables (transmit or receive) fails we’ll have a unidirectional link
failure, and this can cause spanning tree loops. There are two protocols that can take
care of this problem:
LoopGuard
189 | P a g e
UDLD ( Unidirectional Link Detection )
Let’s start by taking a close look at what will happen if we have a unidirectional link
failure:
Imagine the links between the switches are fiber links. In reality there’s a different
connector for transmit and receive. SW3 is receiving BPDUs from SW2 and as a result
the interface has become an alternate port and is in blocking mode.
Now something goes wrong…the transmit connector on SW2 towards SW3 was eaten
by mice failed due to unknown reasons. As a result SW3 is not receiving any BPDUs
from SW2 but it can still send traffic to SW2.
Because SW3 is not receiving anymore BPDUs on its alternate port it will go into
forwarding mode. We now have a one way loop as indicated by the green arrow.
One of the methods we can use to solve our unidirectional link failure is to
configure LoopGuard. When a switch is sending but not receiving BPDUs on the
190 | P a g e
interface, LoopGuard will place the interface in the loop-inconsistent state and block
all traffic:
Let’s take a look what this looks like on actual switches. I will use the same topology:
191 | P a g e
Use the spanning-tree loopguard default command to enable LoopGuard globally. I don’t
have any fiber connectors so I’m unable to create a unidirectional link failure. I can
simulate it however by using BPDUfilter on SW2’s fa0/16 interface. SW3 won’t receive
any BPDUs anymore on its alternate port which will cause it to go into forwarding mode:
SW2(config)#interface fa0/16
SW2(config-if)#spanning-tree portfast trunk
SW2(config-if)#spanning-tree bpdufilter enable
SW3#
*Mar 1 00:17:14.431: %SPANTREE-2-LOOPGUARD_BLOCK: Loop guard blocking port
FastEthernet0/16 on VLAN0001.
Normally this would cause a loop but luckily, we have LoopGuard configured. You can
see this error message appearing in your console, problem solved!
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname SW1
!
spanning-tree loopguard default
!
end
hostname SW2
!
spanning-tree loopguard default
!
interface FastEthernet0/16
spanning-tree portfast trunk
spanning-tree bpdufilter enable
!
end
hostname SW3
!
spanning-tree loopguard default
!
end
If you want you don’t have to configure LoopGuard globally, you can also do it on the
interface level like this:
192 | P a g e
SW3(config-if)#spanning-tree guard loop
The other protocol we can use to deal with unidirectional link failures is called UDLD
(UniDirectional Link Detection). This protocol is not part of the spanning tree toolkit,
but it does help us to prevent loops.
Simply said UDLD is a layer 2 protocol that works like a keepalive mechanism. You send
hello messages; you receive them, and life is good. As soon as you still send hello
messages but don’t receive them anymore you know something is wrong and we’ll block
the interface.
Let’s use the same topology but configure UDLD this time. Don’t forget to get rid of
loopguard first…
SW1(config)#udld ?
aggressive Enable UDLD protocol in aggressive mode on fiber ports except
where locally configured
enable Enable UDLD protocol on fiber ports except where locally
configured
message Set UDLD message parameters
There are a number of methods how you can configure UDLD. You can do it globally
with the udld command, but this will only activate UDLD for fiber links!
There are two options for UDLD:
Normal (default)
Aggressive
193 | P a g e
When you set UDLD to normal it will mark the port as undetermined, but it won’t shut
the interface when something is wrong. This is only used to “inform” you, but it won’t
stop loops.
Aggressive is a better solution. When it loses connectivity to a neighbor it will send a
UDLD frame out once a second for 8 seconds. If the neighbor does not respond the
interface will be put in err-disable mode.
Let’s use two switches to demonstrate UDLD:
SW2(config)#interface fa0/16
SW2(config-if)#udld port aggressive
SW3(config)#interface fa0/16
SW3(config-if)#udld port aggressive
We’ll use SW2 and SW3 to demonstrate UDLD. I’ll use aggressive mode so we can see
that the interface goes down when something is wrong. To see what is going on in real
time we’ll use a debug:
Now the tricky part will be to simulate a unidirectional link failure. LoopGuard was easier
because it was based on BPDUs. UDLD runs its own layer 2 protocol by using the
proprietary MAC address 0100.0ccc.cccc. We can create a filter to block the UDLD
traffic:
194 | P a g e
SW3(config-ext-macl)#deny any host 0100.0ccc.cccc
SW3(config-ext-macl)#permit any any
SW3(config-ext-macl)#exit
SW3(config)#interface fa0/16
SW3(config-if)#mac access-group UDLD-FILTER in
This is a creative way to cause trouble. By filtering the MAC address of UDLD on one
side it will think that there is an unidirectional link failure! Here’s what you will see:
SW2#
UDLD FSM updated port, bi-flag udld_empty_echo, phase udld_detection (Fa0/16)
timeout timer = 0 (Fa0/16)
Phase set to EXT. (Fa0/16)
New_entry = 370CED0 (Fa0/16)
Found an entry from same device (Fa0/16)
Cached entries = 2 (Fa0/16)
Entry (0x3792BE0) deleted: 1 entries cached
Cached entries = 1 (Fa0/16)
Zero IDs in 2way conn list (Fa0/16)
Zero IDs in 2way conn list (Fa0/16)
UDLD disabled port, packet received in extended detection (Fa0/16)
%UDLD-4-UDLD_PORT_DISABLED: UDLD disabled interface Fa0/16, unidirectional link
detected
%PM-4-ERR_DISABLE: udld error detected on Fa0/16, putting Fa0/16 in err-disable
state
You’ll see a lot of debug information flying by, but the end result will be that the port is
now in err-disable state. Here’s a show command you can use to check it:
Interface Fa0/16
---
Port enable administrative configuration setting: Enabled / in aggressive mode
Port enable operational state: Enabled / in aggressive mode
Current bidirectional state: Unidirectional
Current operational state: Disabled port
LoopGuard UDLD
195 | P a g e
fiber) / per port
Yes – requires
Autorecovery Yes err-disable
timeout.
Protection against
No Yes
miswiring
Spanning-Tree RootGuard
RootGuard will make sure you don’t accept a certain switch as a root bridge. BPDUs are
sent and processed normally but if a switch suddenly sends a BPDU with a superior
bridge ID you won’t accept it as the root bridge. Normally SW2 would become the root
bridge because it has the best bridge ID, fortunately we have RootGuard on SW3 so it’s
not going to happen!
Let me demonstrate this with the following topology:
Let me show you the configuration by using SW2 and SW3, first I will make sure that
SW3 is NOT the root bridge:
196 | P a g e
SW2(config)#interface fa0/16
SW2(config-if)#spanning-tree guard root
%SPANTREE-2-ROOTGUARD_CONFIG_CHANGE: Root guard enabled on port FastEthernet0/16.
We get a nice notification message that it has been enabled. Let’s enable a debug so we
can see what is going on:
Now we’ll upset SW2 by changing the priority to the lowest value possible (0) on SW3.
Normally it should now become the root bridge:
SW2#
STP: VLAN0001 heard root 1-000f.34ca.1000 on Fa0/16
supersedes 4097-0019.569d.5700
%SPANTREE-2-ROOTGUARD_BLOCK: Root guard blocking port FastEthernet0/16 on
VLAN0001.
Here goes…SW2 will not accept SW3 as a root bridge. It will block the interface for this
VLAN. Here’s another useful command to verify this:
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname SW2
!
197 | P a g e
spanning-tree vlan 1 priority 4096
!
interface FastEthernet0/16
spanning-tree guard root
!
end
hostname SW3
!
spanning-tree vlan 1 priority 0
!
end
STP Dispute
1. Configuration
Let’s look at an example. I will use the following two switches:
SW1 and SW2 are connected to each other with two links. Here’s the spanning-tree
topology:
SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address fa16.3e4e.be24
Cost 4
Port 2 (GigabitEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
198 | P a g e
Address fa16.3ef4.43e6
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300 sec
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address fa16.3e4e.be24
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
As you can see, SW2 is the root bridge, and all interfaces have the correct port state.
Time to stir things up. I’m using Ethernet interfaces so I can’t pull the cable and cause a
unidirectional link failure. What I can do, is create a mac access-list that denies all
spanning-tree traffic. Before I create and activate it, let’s enable debugging on SW1:
199 | P a g e
This prevents SW2 from receiving any BPDUs from SW1. We can verify this by looking
at the access-list:
What I will do now, is make SW1 the new root bridge. This causes SW1 to change its
interfaces to designated ports. SW2 should select a root and non-designated (alternate)
port:
SW1#
setting bridge id (which=1) prio 1 prio cfg 0 sysid 1 (on) id 0001.fa16.3ef4.43e6
RSTP(1): updt roles, non-tracked event
RSTP(1): we become the root bridge
RSTP(1): Gi0/1 is now designated
RSTP(1): Gi0/2 is now designated
RSTP(1): transmitting a proposal on Gi0/2
RSTP(1): Gi0/1 Dispute!
RSTP(1): Gi0/2 Dispute!
SW1 is changing its interfaces to the STP dispute status. We can see it here too:
SW1#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 1
Address fa16.3ef4.43e6
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
200 | P a g e
Gi0/1 Desg BLK 4 128.2 P2p Dispute
Gi0/2 Desg BLK 4 128.3 P2p Dispute
Both interfaces are still designated ports, but they are blocked and show up “dispute”.
So, why exactly did this happen? The answer lies in the BPDUs that SW2 transmits to
SW1:
As you can see above, the port role (designated) is included in the BPDU. SW2 also
transmits its own MAC address and priority as the root bridge. This doesn’t make sense
since SW1 is the root bridge, the interfaces on SW2 should be a root port and non-
designated (alternate) port, not a designated port. Because it doesn’t match, SW1
changes the state to dispute.
SW2 remains clueless; we can’t blame it since it doesn’t receive the BPDUs from SW1:
SW2#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 4097
Address fa16.3e4e.be24
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
201 | P a g e
Gi0/2 Desg FWD 4 128.3 P2p
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname SW1
!
ip cef
!
spanning-tree mode rapid-pvst
spanning-tree vlan 1 priority 0
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
end
hostname SW2
!
ip cef
!
mac access-list extended NO_STP
deny any host 0180.c200.0000
permit any any
!
spanning-tree mode rapid-pvst
spanning-tree vlan 1 priority 4096
!
interface GigabitEthernet0/1
mac access-group NO_STP in
spanning-tree link-type point-to-point
!
interface GigabitEthernet0/2
mac access-group NO_STP in
spanning-tree link-type point-to-point
!
end
Spanning-tree Bridge Assurance is one of those STP features that help to prevent
bridging loops in your network. When bridge assurance is enabled, BPDUs are sent on
all interfaces of your switch, including blocked interfaces like the alternate or backup
202 | P a g e
port. When an interface doesn’t receive a BPDU for a certain time, the interface goes
into the blocking state.
Once the interface receives BPDUs again, the interface is unblocked and goes through
the normal spanning-tree port states again. This helps to prevent issues (ie,
unidirectional link failures or switch failures where the switch does forward ethernet
frames, but STP is malfunctioning) where for whatever reason, an interface doesn’t
receive BPDUs again, and a blocked interface goes into the forwarding state, causing a
bridging loop.
Bridge assurance is only supported by PVRST+ and MST.
In this lesson, I’ll show you a “before” and “after” scenario, and we will look at bridge
assurance in action.
SW1 is our root bridge, and it sends BPDUs on both interfaces. SW2 has the designated
port on the interface that connects to SW3, so the GigabitEthernet 0/2 interface on SW3
is the alternate port and blocking. Suddenly, SW2 stops sending BPDUs on its
GigabitEthernet 0/2 interface:
Because SW3 doesn’t receive superior BPDUs anymore on its GigabitEthernet 0/2
interface, it decides that the interface becomes a designated port and it forwards data.
We now have a bridging loop:
203 | P a g e
That’s not good…let’s see what happens with bridge assurance.
The difference, however, is that when bridge assurance is enabled, every interface
sends BPDUs. Once again, SW2 has a failure, so it’s no longer sending BPDUs:
204 | P a g e
SW1 and SW3 notice the lack of BPDUs and immediately put their interfaces in the
blocking state. This saves the day as there won’t be a bridging loop.
3. Configuration
Bridge assurance is supported on Cisco IOS since version 12.2(33)SXI, but it seems to
be only available on the Cisco catalyst 6500 series. I’m using three Nexus switches to
demonstrate bridge assurance. If you never worked with NX-OS before, don’t worry.
The output is pretty much the same as on Cisco IOS. This is the topology:
However, we do have to change the spanning-tree port type to network on all interfaces
to activate it:
4. Verification
Let’s take a look at our spanning-tree port states:
VLAN0001
205 | P a g e
Spanning tree enabled protocol rstp
Root ID Priority 1
Address 547f.ee51.3abc
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 1
Address 547f.ee51.3abc
Cost 4
Port 160 (Ethernet1/32)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 1
Address 547f.ee51.3abc
Cost 4
Port 156 (Ethernet1/28)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
206 | P a g e
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Eth1/28 Root FWD 4 128.156 P2p
Eth1/30 Desg FWD 4 128.158 P2p
Everything is working as it should. We have a root bridge (SW1), and the Ethernet 1/30
interface on NX2 is our alternate port. To test bridge assurance, I’ll enable BPDU filter
on one of my interfaces. This causes the interface to no longer send BPDUs, which will
trigger bridge assurance to block an interface.
I’ll enable BPDU filter on the E1/30 interface of NX2:
Once I do this, we see this message on the console of NX2 and NX3:
NX2#
NX2 %$ VDC-1 %$ %STP-2-BRIDGE_ASSURANCE_BLOCK: Bridge Assurance blocking port
Eth1/30 VLAN: 1
NX3#
NX3 %$ VDC-1 %$ %STP-2-BRIDGE_ASSURANCE_BLOCK: Bridge Assurance blocking port
Eth1/30 VLAN: 1.
NX2 is blocking its interface since BPDU filter stops the processing of BPDUs. NX3
blocks its interface since it is no longer receiving BPDUs. Let’s take another look at out
spanning-tree topology:
The E1/30 interface of NX2 was already blocked when it was an alternate port, but now
it has become a designated post and shows “BA_Inc” which means it was blocked
because of bridge assurance. That’s a good thing as it prevents a bridging loop. We see
the same output on NX3:
207 | P a g e
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Eth1/28 Root FWD 4 128.156 P2p
Eth1/30 Desg BKN*4 128.158 P2p *BA_Inc
The E1/30 interface on NX3 is a designated port, but it has been blocked by bridge
assurance. If you remove the BPDU filter, the interfaces will automatically recover from
this bridge assurance error.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname NX1
vlan 1
spanning-tree vlan 1 priority 0
interface Ethernet1/28
spanning-tree port type network
interface Ethernet1/32
spanning-tree port type network
hostname NX2
feature interface-vlan
vlan 1
spanning-tree vlan 1 priority 4096
interface Ethernet1/30
spanning-tree port type network
interface Ethernet1/32
spanning-tree port type network
hostname NX3
vlan 1
interface Ethernet1/28
spanning-tree port type network
interface Ethernet1/30
spanning-tree port type network
5. Conclusion
You have now learned how bridge assurance sends BPDUs on all interfaces, in both
directions. Once a switch detects a lack of BPDUs, it puts the interface in blocking mode,
preventing a possible bridging loop.
208 | P a g e
1.2 Routing Concepts
IP Routing Explained
The actual forwarding of IP packets by routers is called IP routing. This has nothing to do
with the “learning” of network routes through static or dynamic routing protocols. but has
everything to do with the steps that routers have to take when they forward an IP packet
from one interface to another.
In this lesson, I will walk you through an example and show you all steps that occur.
To do this, I will use the following topology:
Above we have two host computers and two routers. H1 is going to send an IP packet to
H2 which has to be routed by R1 and R2.
1. IP Routing Processs
Let’s look at this step-by-step, device-by-device.
1.1. H1
Let’s start with H1. This host creates an IP packet with its own IP address (192.168.1.1)
as the source and H2 (192.168.2.2) as the destination. The first question that H1 will ask
itself is:
Is the destination local or remote?
It answers this question by looking at its own IP address, its subnet mask and the
destination IP address:
C:\Users\H1>ipconfig
209 | P a g e
Windows IP Configuration
C:\Users\H1>arp -a
H1 has an ARP entry for 192.168.1.254. If not, it would have sent an ARP request. We
now have an Ethernet frame that carries an IP packet with the following addresses:
1.2. R1
This Ethernet frame makes it to R1 which has more work to do than our host. The first
thing it does, is check if the FCS (Frame Check Sequence) of the Ethernet frame is
correct or not:
210 | P a g e
If the FCS is incorrect, the frame is dropped right away. There is no error recovery for
Ethernet, this is something that is done by protocols on upper layers, like TCP on the
transport layer.
If the FCS is correct, we will process the frame if:
The destination MAC address is the address of the interface of the router.
The destination MAC address is a broadcast address of the subnet that the router
interface is connected to.
The destination MAC address is a multicast address that the router listens to.
In this case, the destination MAC address matches the MAC address of R1’s
GigabitEthernet 0/1 interface so we will process it. We de-encapsulate (extract) the IP
packet out of the Ethernet frame which is then discarded:
The router will now look at the IP packet, and the first thing it does is check if the header
checksum is OK:
If the header checksum is not correct, the IP packet is dropped right away. There is also
no error recovery on the network layer, we rely on upper layers for this. If the header
checksum is correct, we continue by looking at the destination IP address:
211 | P a g e
R1 now checks its routing table to see if there is a match:
R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Above you can see that R1 knows how to reach the 192.168.2.0/24 network, the next
hop IP address is 192.168.12.2. It will now do a second routing table lookup to see if it
knows how to reach 192.168.12.2, we call this recursive routing. As you can see, there
is an entry for 192.168.12.0/24 with GigabitEthernet 0/2 as the interface to use.
There is one thing left to do with the IP packet before we can forward it. Since we are
routing it, we have to decrease the TTL (Time to Live) field by one. R1 will do this and
since this changes the IP header, we have to calculate a new header checksum.
212 | P a g e
Once this is done, R1 checks its ARP table to see if there is an entry for 192.168.12.2:
R1#show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.1 58 fa16.3e87.9c2a ARPA GigabitEthernet0/1
Internet 192.168.1.254 - fa16.3e3f.fd3c ARPA GigabitEthernet0/1
Internet 192.168.12.1 - fa16.3e02.83a1 ARPA GigabitEthernet0/2
Internet 192.168.12.2 95 fa16.3e01.0c98 ARPA GigabitEthernet0/2
No problem there, we have an entry in the ARP table. If not, R1 will send an ARP
request to find the MAC address of 192.168.12.2. R1 builds a new Ethernet frame with
its own MAC address of the GigabitEthernet 0/2 interface and R2 as the destination. The
IP packet is then encapsulated in this new Ethernet frame.
1.3. R2
This Ethernet frame makes it to R2. Like R1 it will first do this:
R2#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
213 | P a g e
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
R2#show ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.2.2 121 fa16.3e4a.f598 ARPA GigabitEthernet0/1
Internet 192.168.2.254 - fa16.3e3c.7da4 ARPA GigabitEthernet0/1
Internet 192.168.12.1 111 fa16.3e02.83a1 ARPA GigabitEthernet0/2
Internet 192.168.12.2 - fa16.3e01.0c98 ARPA GigabitEthernet0/2
There is an ARP entry there. The new Ethernet frame is created, the IP packet
encapsulated, and it has the following addresses:
1.4. H2
H2 receives the Ethernet frame and will:
214 | P a g e
2. Conclusion
You have now learned how an IP packet is forwarded from one router to another, also
known as IP routing.
Let’s summarize this process.
The host has a simple decision to make:
Is the destination on the local subnet?
o Check ARP table for destination IP address, if empty, send an ARP
request.
Is the destination on a remote subnet?
o Check ARP table for default gateway IP address, if empty, send an ARP
request.
The router has to perform a number of tasks:
When it receives an Ethernet frame, check if the FCS (Frame Check Sequence)
is correct. If not, drop the frame.
Check if the destination address of the frame is:
o destined to our MAC address
o destined to a broadcast address of the subnet our interface is in.
o destined to a multicast address that we listen to.
De-encapsulate the IP packet from the frame, discard the Ethernet frame.
Look for a match in the routing table for the destination IP address, figure out
what the outgoing interface and optionally, the next hop IP address is.
Decrease the TTL (Time to Live) field in the IP header, recalculate the header
checksum.
Encapsulate the IP packet in a new Ethernet frame.
Check the ARP table for the destination IP address or next hop IP address.
Transmit the frame.
215 | P a g e
1.2.a: Introduction to Administrative Distance
Administrative distance is one of those routing concepts that most CCNA students have
difficulty with to understand. In this short lesson I’ll explain to you what administrative
distance is and how it works.
Let me show you an example:
Imagine we have a network that is running two routing protocols at the same time,
OSPF and EIGRP. Both routing protocols are giving information to R1.
EIGRP tells us the router should send IP packets using the path on the top.
OSPF tells us the router should send IP packets using the path on the bottom.
What routing information are we going to use? Both? Use OSPF or EIGRP?
The answer is that when two routing protocols are giving us information about the
same destination network we have to make a choice…you can’t go left and right at the
same time. We need to look at the administrative distance or AD.
216 | P a g e
Administrative Distance
Directly connected 0
Static route 1
EIGRP 90
OSPF 110
RIP 120
The lower the administrative distance the better. As you can see a directly connected
route has an AD of 0. This makes sense since there’s nothing better than having it
directly connected to your router. A static route has a very low administrative distance of
1 which also makes sense since this is something you configure manually. Sometimes
you use a static route to “overrule” a routing protocol’s decisions.
EIGRP has an administrative distance of 90 which makes sense since well, it’s a Cisco
routing protocol. OSPF has 110 and RIP has 120. In our example above we will use the
information EIGRP tells us in the routing table since its AD of 90 is better (lower) than
OSPF which has 110.
Let’s look at an example of an actual router. This is the topology:
Above we see that R1 is connected to both R2 and R3. Here’s the routing table:
R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
217 | P a g e
a - application route
+ - replicated route, % - next hop override, p - overrides from PfR
Above you can see that R1 has learned 2.2.2.0 /24 through RIP. Between the brackets,
we find:
[120/1]
120 is the administrative distance, 1 is the metric. In case of RIP, that’s the hop count.
R1 also has a static route for 3.3.3.0 /24 to R3. Between the brackets we find:
[1/0]
1 is the administrative distance, since this is a static route, there is no metric so it’s 0. I
hope this has been helpful to understand the administrative distance.
218 | P a g e
1.2.b: VRF Lite
In this lesson you will learn about VRFs (Virtual Routing and Forwarding). By default a
router uses a single global routing table that contains all the directly connected
networks and prefixes that it learned through static or dynamic routing protocols.
VRFs are like VLANs for routers, instead of using a single global routing table we can
use multiple virtual routing tables. Each interface of the router is assigned to a different
VRF.
VRFs are commonly used for MPLS deployments, when we use VRFs without MPLS
then we call it VRF lite. That’s what we will focus on in this lesson. Let’s take a look at
an example topology
219 | P a g e
In the topology above we have one ISP router and two customers called “Red” and
“Blue”. Each customer has two sites and those are connected to the ISP router. The ISP
router has only one global routing table so if we connect everything like the topology
above, this is what the routing table will look like:
The ISP router has a single global routing table that has all 4 directly connected
networks. Let’s use VRFs to change this, I want to create a separate routing table for
customer “Blue” and “Red”. First we have to create these VRFs:
Globally we create the VRFs, one for each customer. Our next step is to add the
interfaces of the ISP router to the correct VRF. Here’s how:
220 | P a g e
On the interface level we use the ip vrf forwarding command to assign the interface to
the correct VRF. Once you do this , you’ll have to add the IP address again. Let’s
configure the remaining interfaces:
All interfaces are now configured. There’s a useful command you can use to see all the
VRFs and their interfaces:
ISP#show ip vrf
Name Default RD Interfaces
Blue Fa0/0
Fa2/0
Red Fa1/0
Fa3/0
Our VRFs are configured, let’s take a look at the global routing table of the ISP router:
The global routing table has no entries, this is because all interfaces were added to a
VRF. Let’s check the VRF routing tables:
We use the show ip route command, but you’ll need to specify which VRF you want to
look at. As you can see, each VRF has its own routing table with the interfaces that we
configured earlier.
If you want to do something on the router like sending a ping then you’ll have to specify
which VRF you want to use. By default it will use the global routing table. Here’s an
example how to send a ping:
221 | P a g e
ISP#ping vrf Blue 192.168.1.1
That’s easy enough, just don’t forget to specify the correct VRF. The same thing applies
to routing (protocols). For example if you want to configure a static route you’ll have to
specify the correct VRF. Take a look at the example below:
Router Blue1 has a loopback interface with IP address 1.1.1.1 /32. Let’s create a static
route on the ISP router so that we can reach it:
We use the same ip route command, but I specified to what VRF the static route
belongs. Let’s see if this works:
Easy enough, the ping works. What about routing protocols? We can use OSPF, EIGRP,
BGP…no problem at all. Let’s look at an example for OSPF:
222 | P a g e
Customer “Blue” and “Red” both want to use OSPF to advertise their networks. Since we
use VRFs, everything is separated. Let’s start with the OSPF configuration for customer
Blue:
Blue1(config)#router ospf 1
Blue1(config-router)#network 192.168.1.0 0.0.0.255 area 0
Blue1(config-router)#network 1.1.1.1 0.0.0.0 area 0
Blue2(config)#router ospf 1
Blue2(config-router)#network 192.168.3.0 0.0.0.255 area 0
Blue2(config-router)#network 3.3.3.3 0.0.0.0 area 0
The OSPF configuration for the customer routers is pretty straight-forward. On the ISP
router, we’ll have to specify what VRF we want to use:
We configure OSPF process 1 and specify the VRF that we want to use, that’s all there
is to it. Let’s do the same for customer Red:
Red1(config)#router ospf 1
Red1(config-router)#network 192.168.2.0 0.0.0.255 area 0
Red1(config-router)#network 2.2.2.2 0.0.0.0 area 0
Red2(config)#router ospf 1
Red2(config-router)#network 192.168.4.0 0.0.0.255 area 0
Red2(config-router)#network 4.4.4.4 0.0.0.0 area 0
223 | P a g e
ISP(config-router)#network 192.168.4.0 0.0.0.255 area 0
The configuration is similar, I had to use another process ID on the ISP router since the
first one is used for customer Blue. Here’s what the VRF routing tables on the ISP router
look like now:
Two separate routing tables with the prefixes from each VRF, this is looking good.
This is what VRF lite is about, it has one downside though…it’s not a scalable solution.
In our example we only used a single ISP router but what if we want to use VRFs and
multiple ISP routers? That’s something we’ll discuss in the EVN (Easy Virtual Network)
lesson.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname Blue1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
!
router ospf 1
network 1.1.1.1 0.0.0.0 area 0
network 192.168.1.0 0.0.0.255 area 0
!
end
hostname Blue2
224 | P a g e
!
ip cef
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.3.3 255.255.255.0
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 0
network 192.168.3.0 0.0.0.255 area 0
!
end
hostname ISP
!
ip cef
!
ip vrf Blue
!
ip vrf Red
!
interface FastEthernet0/0
ip vrf forwarding Blue
ip address 192.168.1.254 255.255.255.0
!
interface FastEthernet1/0
ip vrf forwarding Red
ip address 192.168.2.254 255.255.255.0
!
interface FastEtherne2/0
ip vrf forwarding Blue
ip address 192.168.3.254 255.255.255.0
!
interface FastEthernet3/0
ip vrf forwarding Red
ip address 192.168.4.254 255.255.255.0
!
router ospf 1 vrf Blue
network 192.168.1.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 0
!
router ospf 2 vrf Red
network 192.168.2.0 0.0.0.255 area 0
network 192.168.4.0 0.0.0.255 area 0
!
end
hostname Red1
!
ip cef
!
interface Loopback0
225 | P a g e
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.2.2 255.255.255.0
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
network 192.168.2.0 0.0.0.255 area 0
!
end
hostname Red2
!
ip cef
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.4.4 255.255.255.0
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 192.168.4.0 0.0.0.255 area 0
!
end
1. Configuration
This is the topology I will use:
226 | P a g e
We have an ISP router that is connected to two customers. For each customer, we use a
different VRF:
VRF “RED” for Red1
VRF “BLUE” for Blue1
Want to take a look for yourself? Here you will find the startup configuration of each
device.
hostname ISP
!
ip vrf BLUE
!
ip vrf RED
!
ip cef
!
interface GigabitEthernet0/1
ip vrf forwarding RED
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip vrf forwarding BLUE
ip address 192.168.23.2 255.255.255.0
!
end
hostname Red1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
ip address 11.11.11.11 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
!
end
hostname Blue1
!
227 | P a g e
ip cef
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Loopback1
ip address 33.33.33.33 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.23.3 255.255.255.0
!
end
With the configuration above, we only have connectivity within a VRF. What if we want
connectivity between VRF RED and BLUE?
Let’s start with the static routes option. According to this Cisco document, static routes
directly between VRFs are not supported. What does work, is routing traffic from a VRF
to the global routing table and then to the destination VRF. One advantage of using
static routes is that you can configure exactly which routes should be reachable without
the hassle of configuring MP-BGP.
I’ll show you how to get connectivity between 1.1.1.1/32 in VRF RED and 3.3.3.3/32 in
VRF BLUE.
1.1.1. Configuration
First, let’s create a default route on the Red1 and Blue1 routers so that they send all
unknown traffic towards the ISP router:
In each VRF, we add a static route for the destination in the other VRF that we want to
reach. This static route is pointed to the global routing table:
228 | P a g e
We need to add two static routes in the global routing table of the ISP router so that it
knows how to reach the next hop addresses:
1.1.2. Verification
Let’s look at the routing tables of our ISP router. Here’s the routing table of VRF RED:
Above we see the static route for 3.3.3.3/32 that points to 192.168.23.3. It doesn’t show
it, but this static route points to the global routing table. Here is the route for 1.1.1.1/32 in
routing table VRF BLUE:
Above, we see the entries for the next hop addresses in the global routing table.
The ISP router is now able to route from one VRF into the global routing table and into
another VRF. Let’s try a quick ping:
Mission accomplished.
229 | P a g e
Want to take a look for yourself? Here you will find the startup configuration of each
device.
hostname Blue1
!
ip cef
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Loopback1
ip address 33.33.33.33 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.23.3 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.23.2
!
end
hostname ISP
!
ip vrf BLUE
!
ip vrf RED
!
ip cef
!
interface GigabitEthernet0/1
ip vrf forwarding RED
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip vrf forwarding BLUE
ip address 192.168.23.2 255.255.255.0
!
ip route 192.168.12.1 255.255.255.255 GigabitEthernet0/1
ip route 192.168.23.3 255.255.255.255 GigabitEthernet0/2
ip route vrf BLUE 1.1.1.1 255.255.255.255 192.168.12.1 global
ip route vrf RED 3.3.3.3 255.255.255.255 192.168.23.3 global
!
end
hostname Red1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
ip address 11.11.11.11 255.255.255.255
230 | P a g e
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.12.2
!
end
1.2. MP-BGP
Let’s see how we can get connectivity between the VRFs by using MP-BGP. This is
pretty much the same as MPLS VPN PE CE but without MPLS. We will use MP-BGP to
redistribute routes from one VRF into another.
To demonstrate this, I will redistribute static routes that I create on the ISP router into
MP-BGP. Of course, you can also use a routing protocol like OSPF or EIGRP between
the ISP and customer routers.
1.2.1. Configuration
Let’s create a default route on the customer routers that point to the ISP:
On the ISP router, I have to do two things under the VRF configuration:
We need an RD (Route Distinguisher) for each VRF.
We need an RT (Route Target) and export/import our routes.
VRF RED exports its routes with RT 1:1 and imports routes with RT 3:3. Here’s VRF
BLUE:
231 | P a g e
ISP(config)#ip vrf BLUE
ISP(config-vrf)#rd 3:3
ISP(config-vrf)#route-target export 3:3
ISP(config-vrf)#route-target import 1:1
Now we can worry about getting the routes into each other’s VRF. For each VRF, I will
create a static route that points to the loopback 0 interface of the other VRF:
Now we can redistribute these into MP-BGP. Let’s start a new BGP process. It doesn’t
matter what AS number you use since we won’t have any neighbors. Since I don’t have
any IP addresses in my global routing table, BGP will complain about being unable to
pick a router ID so I’ll configure one manually:
ISP(config)#router bgp 2
ISP(config-router)#bgp router-id 2.2.2.2
Our static and directly connected routes are now in MP-BGP and will be
exported/imported according to the route-targets we configured.
1.2.2. Verification
Let’s take a look at the VPN routes of each VRF:
232 | P a g e
VRF RED has learned the 3.3.3.3/32 and 192.168.23.0/24 prefixes. Here’s VRF BLUE:
VRF BLUE has the 1.1.1.1/32 and 192.168.12.0/24 prefixes. We can also see these in
the routing table of each VRF:
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname Blue1
!
ip cef
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Loopback1
ip address 33.33.33.33 255.255.255.255
!
233 | P a g e
interface GigabitEthernet0/1
ip address 192.168.23.3 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.23.2
!
end
hostname ISP
!
ip vrf BLUE
rd 3:3
route-target export 3:3
route-target import 1:1
!
ip vrf RED
rd 1:1
route-target export 1:1
route-target import 3:3
!
ip cef
!
interface GigabitEthernet0/1
ip vrf forwarding RED
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip vrf forwarding BLUE
ip address 192.168.23.2 255.255.255.0
!
router bgp 2
bgp router-id 2.2.2.2
bgp log-neighbor-changes
!
address-family ipv4 vrf BLUE
redistribute connected
redistribute static
exit-address-family
!
address-family ipv4 vrf RED
redistribute connected
redistribute static
exit-address-family
!
ip route vrf BLUE 3.3.3.3 255.255.255.255 192.168.23.3
ip route vrf RED 1.1.1.1 255.255.255.255 192.168.12.1
!
end
hostname Red1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
234 | P a g e
!
interface Loopback1
ip address 11.11.11.11 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.12.2
!
end
2. Conclusion
You have now learned how to leak routes from one VRF into another:
How to use static routes to route from a VRF into the global routing table and into
another VRF.
How to use MP-BGP to exchange routes from one VRF into another.
235 | P a g e
1.2.c: Static Routing
In this lesson we’ll take a look at static routes, and in particular how to configure them.
Let me show you the following topology:
Look at the network in the picture above. We have a network with two sites,
headquarters and a branch office.
The headquarters is connected to the Branch office. Behind the branch office is a
network with the 2.2.2.0 /24 network. We want to make sure that the headquarters can
reach the 2.2.2.0 /24 network.
Let me show you how we configure this network using a static route:
HQ>enable
HQ#configure terminal
Branch>enable
Branch#configure terminal
Branch(config)#interface fastEthernet0/0
Branch(config-if)#no shutdown
Branch(config-if)#ip address 192.168.12.2 255.255.255.0
Branch(config-if)#exit
236 | P a g e
Branch(config)#interface fastEthernet 1/0
Branch(config-if)#no shutdown
Branch(config-if)#ip address 2.2.2.2 255.255.255.0
Then I’ll configure the IP addresses on the interfaces; don’t forget to do a “no shutdown”
on the interfaces.
Let’s take a look at the routing tables of both routers:
HQ#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1,
ia - IS-IS inter area, * - candidate default,
o - ODR, P - periodic downloaded static route
Branch#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1,
o - ODR, P - periodic downloaded static route
Use the show ip route command to view the routing table. This is what a router uses to
make decisions where to forward IP packets to. By default a router only knows its
directly connected networks. We configured an IP address with a subnet mask on the
interface, so the router also knows the network address.
Router HQ knows about network 192.168.12.0/24.
Router Branch knows about network 192.168.12.0/24 and 2.2.2.0/24.
At this moment our HQ router has no idea how to reach network 2.2.2.0/24 because
there is no entry in the routing table. What will happen when we try to reach it? Let’s
check:
HQ#ping 2.2.2.2
237 | P a g e
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
The ping will fail. This router checks its routing table, discovers that it doesn’t know how
to reach network 2.2.2.0 /24 and will drop the traffic. Let’s use a static route to tell router
HQ how to reach this network!
We use the ip route command to create a static route. Let me break it down for you:
2.2.2.0 is the network we want to reach.
255.255.255.0 is the subnet mask of the network.
192.168.12.2 is called the next hop IP address. It’s the IP address where we want
to send traffic to. In this example that’s the branch router.
I’m telling router HQ that it can reach network 2.2.2.0 /24 by sending traffic to IP address
192.168.12.2 (the Branch router).
Let’s take another look at the routing table to see if anything has changed:
HQ#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 -IS-IS inter area, *
- candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
We can now see an entry for network 2.2.2.0/24 in our routing table. Whenever router
HQ has traffic for network 2.2.2.0 /24 it will send it to IP address 192.168.12.2 (router
Branch). Let’s see if our ping is now working:
HQ#ping 2.2.2.2
238 | P a g e
Bingo now it’s working. Router HQ knows how to reach network 2.2.2.0 /24 because of
our static route.
Are you following me so far? Whenever an IP packet arrives at a router it will check its
routing table to see if it knows about the destination network. If it does it will forward the
IP packet and if it has no idea where to send traffic it will drop the IP packet.
Want to take a look for yourself? Here you will find the startup configuration of each
device.
hostname HQ
!
interface FastEthernet 0/0
ip address 192.168.12.1 255.255.255.0
!
ip route 2.2.2.0 255.255.255.0 192.168.12.2
!
end
hostname Branch
!
interface fastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
interface fastEthernet 1/0
ip address 2.2.2.2 255.255.255.0
!
end
There is another situation where a static route might be useful, let me demonstrate
another network:
In the picture above our HQ router is connected to an ISP (Internet Service Provider).
There are many networks on the Internet so do we require all of those networks on the
Internet in our routing table? The answer is no because we can use a default route, let
me show you what it is:
239 | P a g e
HQ#ping 1.2.3.1
It’s always a good idea to check connectivity. A quick ping to the ISP router proves that
we can reach the ISP.
HQ#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 -IS-IS inter area, *
- candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Right now the HQ router only knows how to reach network 1.2.3.0/24 because it’s
directly connected. Let’s configure a default route so that we can reach the Internet:
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname HQ
!
interface FastEthernet 1/0
ip address 1.2.3.2 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 1.2.3.1
!
end
240 | P a g e
hostname ISP
!
interface FastEthernet 0/0
ip address 1.2.3.1 255.255.255.0
!
end
Something important to know about routers is that they always will use the most specific
match in their routing table. Let me give you an example:
In the picture above I have many routers and a lot of networks. If I want to configure full
reachability between the routers then I have to configure a LOT of static routes to make
this work and you don’t have any backups. If a link fails you’ll need to edit your static
route and send traffic another direction. The picture above would be more suitable
for dynamic routing.
If you know how to configure a static route for IPv4 then you shouldn’t have any issues
with IPv6 static routes. The configuration and syntax are similar, there are only some
minor differences. In this lesson, I will show you how to configure all IPv6 static route
types.
241 | P a g e
1. Configuration
To demonstrate this topology, I will use the following topology:
R1 and R2 are connected with a serial link. R2 has a loopback interface with IPv6
addresses 2001:DB8:2:2::2/64. Let’s see if we can reach this address.
S 2001:DB8:2:2::/64 [1/0]
via Serial0/0/0, directly connected
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
If you try this with a FastEthernet interface, you’ll see that the router will accept the
command, but the ping won’t work. You can’t use this for multi-access interfaces.
242 | P a g e
R1(config)#ipv6 route 2001:DB8:2:2::/64 2001:DB8:12:12::2
S 2001:DB8:2:2::/64 [1/0]
via 2001:DB8:12:12::2
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
No problem at all…
Instead of global unicast addresses, you can also use unique local addresses. These
are the IPv6 equivalent of IPv4 private addresses.
Let’s use this as the next hop address. When you use a global unicast address as the
next hop, your router will be able to look at the routing table and figure out what outgoing
interface to use to reach this global unicast address. With link local addresses, the router
has no clue which outgoing interface to use so you will have to specify both the outgoing
interface and the link local address:
243 | P a g e
S 2001:DB8:2:2::/64 [1/0]
via FE80::21C:F6FF:FE11:41F0, Serial0/0/0
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
No problems there.
S ::/0 [1/0]
via Serial0/0/0, directly connected
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
244 | P a g e
Here’s the routing table:
S ::/0 [1/0]
via 2001:DB8:12:12::2
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
S ::/0 [1/0]
via FE80::21C:F6FF:FE11:41F0, Serial0/0/0
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
245 | P a g e
1.3.1. Static host route – outgoing interface
First we will try the outgoing interface:
S 2001:DB8:2:2::2/128 [1/0]
via Serial0/0/0, directly connected
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
S 2001:DB8:2:2::2/128 [1/0]
via 2001:DB8:12:12::2
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
246 | P a g e
Here’s R1’s routing table:
S 2001:DB8:2:2::2/128 [1/0]
via FE80::21C:F6FF:FE11:41F0, Serial0/0/0
R1#ping 2001:DB8:2:2::2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2001:DB8:2:2::2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/4 ms
247 | P a g e
R1(config)#ipv6 route 2001:DB8:23:23::/64 Serial 0/0/0 2
Note that at the end of the line above, I specified the administrative distance with a value
of 2. With both interfaces up, R1 will send all traffic to R3:
S 2001:DB8:23:23::/64 [1/0]
via 2001:DB8:13:13::3
Above you can see that the default administrative distance is 1. Let’s shut the
FastEthernet 0/0 interface to test our static floating route:
S 2001:DB8:2:2::/64 [2/0]
via Serial0/0/0, directly connected
The entry to R2 is now installed. You can also see the administrative distance value of
two in the routing table.
S 2001:DB8:2:2::/64 [2/0]
via 2001:DB8:12:12::2
248 | P a g e
Here is the routing table:
S 2001:DB8:2:2::/64 [2/0]
via FE80::21C:F6FF:FE11:41F0, Serial0/0/0
2. Conclusion
You have now learned how to configure the following IPv6 static routes:
Static route for a prefix
Static default route
Static host route
Static floating route
249 | P a g e
1.2.d: Policy Based Routing
1. Configuration
Take a look at the topology picture above. OSPF is configured on all routers. Since we
are using Gigabit interfaces everywhere, traffic from R1 destined to 4.4.4.4 would
normally be load balanced between R2 and R3. However, I changed the cost on the
Gigabit Ethernet 0/3 interface of R1 so that all traffic will go from R1 > R2 > R4.
Want to try this for yourself? Here you will find the startup configuration of each device.
hostname H1
250 | P a g e
!
no ip routing
!
no ip cef
!
interface GigabitEthernet0/1
ip address 192.168.1.100 255.255.255.0
!
ip default-gateway 192.168.1.254
!
end
hostname R1
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.1.254 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.12.1 255.255.255.0
!
interface GigabitEthernet0/3
ip address 192.168.13.1 255.255.255.0
ip ospf cost 1000
!
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
network 192.168.12.0 0.0.0.255 area 0
network 192.168.13.0 0.0.0.255 area 0
!
end
hostname R2
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.24.2 255.255.255.0
!
router ospf 1
network 192.168.12.0 0.0.0.255 area 0
network 192.168.24.0 0.0.0.255 area 0
!
end
hostname R3
!
ip cef
251 | P a g e
!
interface GigabitEthernet0/0
no ip address
!
interface GigabitEthernet0/1
ip address 192.168.13.3 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.34.3 255.255.255.0
!
router ospf 1
network 192.168.13.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
end
hostname R4
!
ip cef
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.24.4 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.34.4 255.255.255.0
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 192.168.24.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
end
Above you can see the increased cost. Let’s try a quick traceroute from H1:
252 | P a g e
Now let’s say that I want to use the link in between R1 and R3 to reach 4.4.4.4. I could
influence the metric for OSPF, but this applies to all traffic. What if I wanted to use this
link for certain traffic only?
We could use the link in between R1/R2 for the majority of our traffic and use the link
between R1/R3 only for certain traffic. This can be very useful. For example, imagine
that the link between R1/R3 is a dedicated link that offers QoS for VoIP traffic.
This is something we can achieve with PBR (Policy Based Routing) Let me show you
how!
Now let’s say that we want all ICMP traffic from H1 destined for 4.4.4.4 to cross the link
between R1/R3. Here’s how to do this:
First, I create an access-list that matches my traffic. Now we have to create a route-map:
Whenever the traffic matches the access-list, we will change the next hop to
192.168.13.3 (R3).
Last but not least, let’s activate it:
R1#debug ip policy
Policy routing debugging is on
253 | P a g e
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 13/13/13 ms
R1#
IP: s=192.168.1.100 (GigabitEthernet0/1), d=4.4.4.4, len 100, FIB policy match
IP: s=192.168.1.100 (GigabitEthernet0/1), d=4.4.4.4, len 100, PBR_H1 Counted
IP: s=192.168.1.100 (GigabitEthernet0/1), d=4.4.4.4, g=192.168.13.3, len 100, FIB
policy routed
Above you can see that it has been policy routed towards 192.168.13.3. We can also
verify this by looking at the route-map:
Let’s try some traffic that doesn’t match our access-list. Telnet for example:
H1#telnet 4.4.4.4
Trying 4.4.4.4 ... Open
R1#
IP: s=192.168.1.100 (GigabitEthernet0/1), d=4.4.4.4, len 40, FIB policy
rejected(no match) - normal forwarding
As you can see above, this telnet traffic is routed using the normal path.
There is one more thing I’d like to show you. With policy-based routing, there is a
difference between traffic that is going through the router and traffic that
is originated from the router.
The example above is for traffic that went through our router. What if we want to policy
route traffic that is originated from R1? We will have to use another command to activate
it. Let’s create another route-map:
254 | P a g e
R1(config)#ip access-list extended ICMP_R1
R1(config-ext-nacl)#permit icmp host 192.168.12.1 host 4.4.4.4
R1(config-ext-nacl)#permit icmp host 192.168.13.1 host 4.4.4.4
The route-map above will redirect all traffic from R1 to 4.4.4.4 towards R3. To activate
this, we need to use another command:
This time, we need to use the ip local policy command. Let’s test this:
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname H1
!
no ip routing
!
no ip cef
!
interface GigabitEthernet0/1
ip address 192.168.1.100 255.255.255.0
!
ip default-gateway 192.168.1.254
!
end
hostname R1
!
ip cef
!
interface GigabitEthernet0/1
255 | P a g e
ip address 192.168.1.254 255.255.255.0
ip policy route-map PBR_H1
!
interface GigabitEthernet0/2
ip address 192.168.12.1 255.255.255.0
!
interface GigabitEthernet0/3
ip address 192.168.13.1 255.255.255.0
ip ospf cost 1000
!
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
network 192.168.12.0 0.0.0.255 area 0
network 192.168.13.0 0.0.0.255 area 0
!
ip local policy route-map PBR_R1
!
ip access-list extended ICMP_H1
permit icmp host 192.168.1.100 host 4.4.4.4
ip access-list extended ICMP_R1
permit icmp host 192.168.12.1 host 4.4.4.4
permit icmp host 192.168.13.1 host 4.4.4.4
!
route-map PBR_H1 permit 10
match ip address ICMP_H1
set ip next-hop 192.168.13.3
!
route-map PBR_R1 permit 10
match ip address ICMP_R1
set ip next-hop 192.168.13.3
!
end
hostname R2
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.24.2 255.255.255.0
!
router ospf 1
network 192.168.12.0 0.0.0.255 area 0
network 192.168.24.0 0.0.0.255 area 0
!
end
hostname R3
!
ip cef
!
interface GigabitEthernet0/1
256 | P a g e
ip address 192.168.13.3 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.34.3 255.255.255.0
!
router ospf 1
network 192.168.13.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
end
hostname R4
!
ip cef
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.24.4 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.34.4 255.255.255.0
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 192.168.24.0 0.0.0.255 area 0
network 192.168.34.0 0.0.0.255 area 0
!
line vty 0 4
login
transport input telnet
!
end
2. Conclusion
Policy-based routing allows us to overrule the global routing table for traffic that matches
our access-list. This can be a great way to redirect traffic for certain applications. To
activate PBR, there is a difference for traffic that is going through the router or that is
originated by the router:
Use the ip policy command under the interface for traffic that is going through
the router.
Use the ip policy local command globally for traffic that is originated by the
router.
257 | P a g e
1.2.f: Route filtering with any routing protocol
Distribute-list
R1 and R2 are connected to each other and running EIGRP. On R2 I have added a
couple of loopback interfaces with prefixes that we will advertise in EIGRP. Here is the
configuration:
R1(config)#router eigrp 12
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.12.0
R2(config)#router eigrp 12
258 | P a g e
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.12.0
R2(config-router)#network 172.16.0.0 0.0.3.255
If we look at the routing table of router R1 we can see all those networks on the
loopback interfaces as it should be. Now we’ll see if we can do some filtering.
R1(config)#router eigrp 12
R1(config-router)#distribute-list ?
<1-199> IP access list number
<1300-2699> IP expanded access list number
WORD Access-list name
gateway Filtering incoming updates based on gateway
prefix Filter prefixes in routing updates
route-map Filter prefixes based on the route-map
R1(config-router)#distribute-list 1 ?
in Filter incoming routing updates
out Filter outgoing routing updates
If you specify an access-list number you can choose if this route filter has to
be inbound or outbound.
R1(config-router)#distribute-list 1 in ?
Async Async interface
BVI Bridge-Group Virtual Interface
CDMA-Ix CDMA Ix interface
CTunnel CTunnel interface
Dialer Dialer interface
FastEthernet FastEthernet IEEE 802.3
Lex Lex interface
Loopback Loopback interface
MFR Multilink Frame Relay bundle interface
Multilink Multilink-group interface
259 | P a g e
Null Null interface
Port-channel Ethernet Channel of interfaces
Tunnel Tunnel interface
Vif PGM Multicast Host interface
Virtual-PPP Virtual PPP interface
Virtual-Template Virtual Template interface
Virtual-TokenRing Virtual TokenRing
<cr>
If you want you can choose the interface where to apply the inbound route filter to. If you
don’t specify an interface it will apply to all interfaces.
I’m going to apply it to the FastEthernet 0/0 interface since that’s the one where we
receive information from router R2 on.
Let’s create an access-list that will filter 172.16.1.0 /24 and permit all the other networks.
R1#
%DUAL-5-NBRCHANGE: IP-EIGRP(0) 12: Neighbor 192.168.12.2 (FastEthernet0/0) is
resync: route configuration changed
You’ll see a message showing you that the route filter has changed.
You can see 172.16.1.0 /24 has been filtered from the routing table. The matches in the
access-list also tell us we have filtered this network. Using an access-list is the most
simple method of route filtering. There are two other options, let me show you:
R1(config-router)#distribute-list ?
<1-199> IP access list number
<1300-2699> IP expanded access list number
260 | P a g e
WORD Access-list name
gateway Filtering incoming updates based on gateway
prefix Filter prefixes in routing updates
route-map Filter prefixes based on the route-map
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
router eigrp 12
distribute-list 1 in FastEthernet0/0
network 192.168.12.0
!
access-list 1 deny 172.16.1.0 0.0.0.255
access-list 1 permit any
!
end
hostname R2
!
interface Loopback0
ip address 172.16.0.1 255.255.255.0
!
interface Loopback1
ip address 172.16.1.1 255.255.255.0
!
interface Loopback2
ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
ip address 172.16.3.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
router eigrp 12
network 172.16.0.0 0.0.3.255
network 192.168.12.0
!
end
Using an access-list is the simplest method of filtering. The two other options are prefix-
lists and route-maps. I’ll cover those two in another lesson.
Prefix-List
261 | P a g e
Prefix-lists can be used to filter prefixes and are far more powerful than simple access-
lists. Let’s say I want to filter all prefixes that fall within the 10.0.0.0 range and that have
a subnet mask between /24 and /28. Do you think you could do this with an access-list?
It will be difficult right…with a prefix-list this is very easy to do!
Most CCNP students find prefix-lists difficult to understand so in this lesson I’ll show you
how prefix-lists work by using them as route filters.
I will show you different scenarios and different filters. Here is the topology that we will
use:
Above you see two routers called “R1” and “R2”. On R2 we have a couple of loopback
interfaces with prefixes that we will advertise in EIGRP. I’m doing this so we have a
number of prefixes to play with. Here is the configuration:
R1(config)#router eigrp 12
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.12.0
R2(config)#router eigrp 12
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.12.0
R2(config-router)#network 172.16.0.0 0.0.3.255
If we look at the routing table of R1 we can see all those networks on the loopback
interfaces as it should be. Now we’ll see if we can do some filtering. Let’s start with a
simple prefix-list that filters 172.16.1.0 /24 but permits everything else:
262 | P a g e
By using the ip prefix-list command you can create prefix lists. As you can see it looks
a bit similar as my access-list but instead of typing wildcards we just specify the number
of bits. The first line denies 172.16.1.0/24 and the second line permits 0.0.0.0/0 (all
networks) if they have a subnet mask of /32 or smaller…in other words “everything”. This
line is the equivalent of “permit ip any any”.
Let’s enable it on R1 to see what the result is:
R1(config)#router eigrp 12
R1(config-router)#distribute-list prefix FILTERTHIS in
As you can see 172.16.1.0/24 has been filtered and all the other networks are
permitted.
The true power of the prefix list is in the ge (Greater than or Equal to) and le (less
than or equal to) operators. Let’s look at some examples:
In this example I’m using the le operator. This prefix-list statement says that all networks
that fall within the 10.0.0.0/8 range AND that have a subnet mask of /19 or less are
permitted.
If I have a network with 10.0.0.0 /21 it will be denied by this prefix list. It falls within the
10.0.0.0 /8 range, but it has a subnet mask of /21. I’m using the le operator which says
that the subnet mask should be /19 or smaller.
Let’s say I have another network with 10.0.0.0 /17 then it will be permitted by this prefix-
list. It falls within the 10.0.0.0/8 range and has a subnet mask that is smaller than /19.
Are you following me here? Let me give you an example on our routers:
R2(config)#interface loopback 10
R2(config-if)#ip address 10.1.1.1 255.255.0.0
R2(config-if)#interface loopback 11
R2(config-if)#ip address 10.2.2.2 255.255.128.0
R2(config-if)#interface loopback 12
R2(config-if)#ip address 10.3.3.3 255.255.192.0
R2(config-if)#interface loopback 13
R2(config-if)#ip address 10.4.4.4 255.255.224.0
R2(config-if)#interface loopback 14
R2(config-if)#ip address 10.5.5.5 255.255.240.0
R2(config-if)#interface loopback 15
R2(config-if)#ip address 10.6.6.6 255.255.248.0
263 | P a g e
First we’ll add a couple of loopback interfaces on R2. If you look closely you can see I’m
using different subnet masks.
R2(config)#router eigrp 12
R2(config-router)#network 10.0.0.0
R1(config)#router eigrp 12
R1(config-router)#no distribute-list prefix FILTERTHIS in
Now we see all the networks that fall within the 172.16.0.0/16 and 10.0.0.0/8 range.
Time to enable that prefix-list I just created.
R1(config)#router eigrp 12
R1(config-router)#distribute-list prefix RENETEST in
264 | P a g e
ip prefix-list RENETEST: 1 entries
seq 5 permit 10.0.0.0/8 le 19
Does this make sense? Let’s walk through a couple more examples together!
This time I’m using the ge operator. Ge 20 means that the network needs to have a
subnet mask of /20 or larger in order to be permitted. 10.0.0.0 /8 is the range we are
going to check.
A network with 10.55.55.0 /25 will be permitted because it falls within the 10.0.0.0 /8
range and has a subnet mask of /25 which is larger than /20.
What about 10.60.0.0 /19? It falls within the 10.0.0.0 /8 range, but it is not permitted
because it has a subnet mask of /19…our ge operator says it should be /20 or larger.
Hmm interesting…what about 192.168.12.0 /25? The subnet mask of /25 matches our
ge operator but it doesn’t fall within the 10.0.0.0 /8 range, so it’s not permitted. Let’s see
what happens if I activate this prefix-list on R1:
R1(config)#router eigrp 12
R1(config-router)#no distribute-list prefix RENETEST in
R1(config-router)#distribute-list prefix RENETEST2 in
First disable the old prefix-list and secondly enable the new one.
265 | P a g e
Everything in the 172.16.0.0/16 range is filtered because it’s not permitted in our
prefix-list.
All networks in the 10.0.0.0/8 range with a subnet mask that is smaller than 20
are filtered.
All networks in the 10.0.0.0/8 range with a subnet mask that is 20 or larger are
permitted, that means only 10.6.0.0/21 and 10.5.0.0/20
10.22.0.0 /18 will be permitted because it falls within the 10.0.0.0 /8 range and has a
subnet mask of /18.
10.55.0.0 / 26 will be denied. It falls within the 10.0.0.0 /8 range but the subnet mask
is /26 which doesn’t match my ge or le operators.
10.4.4.0 /14 will be denied. It falls within the 10.0.0.0 /8 range but the subnet mask is /14
which doesn’t match my ge or le operators.
192.168.12.0 /18 will be denied. It matches my ge and le operators, but it doesn’t fall
within the 10.0.0.0 /8 range.
Let’s activate it on R1 and see what the result is:
R1(config)#router eigrp 12
R1(config-router)#no distribute-list prefix RENETEST2 in
R1(config-router)#distribute-list prefix RENETEST3 in
First we’ll remove the old prefix-list and activate the new one…
266 | P a g e
This one is interesting…let’s break it down in pieces. It’s permitting 128.0.0.0 /2 and the
ge operator says the subnet mask should be /17 or larger. 128.0.0.0 is the start of the
class B range and the /2 says that we have to check the first two bits. 128.0.0.0 /2
covers the entire class B network range. This prefix-list will permit any subnet in the
class B network range that has a subnet mask of /17 or larger.
I showed you this one before…this one says permit 0.0.0.0 /0 which covers the entire
network range. We have a le 32 operator which says that the subnet mask should be /32
or smaller. What does this mean? It means its matching ALL networks!
We don’t have any ge or le operators and this prefix-list shows 0.0.0.0 /0. It’s only
permitting the default route…
Last one…promise! The network range to check is 0.0.0.0 and we have /1 which means
we are only checking the first bit. This effectively matches the whole class A range.
We have a le operator with 27 which tells us the subnet mask should be /27 or smaller.
This prefix-list matches all subnets within the class A range that has a subnet mask of
/27 or smaller.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R2
!
interface Loopback0
ip address 172.16.0.1 255.255.255.0
!
interface Loopback1
ip address 172.16.1.1 255.255.255.0
!
interface Loopback2
ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
ip address 172.16.3.1 255.255.255.0
!
interface Loopback10
ip address 10.1.1.1 255.255.0.0
!
interface Loopback11
ip address 10.2.2.2 255.255.128.0
267 | P a g e
!
interface Loopback12
ip address 10.3.3.3 255.255.192.0
!
interface Loopback13
ip address 10.4.4.4 255.255.224.0
!
interface Loopback14
ip address 10.5.5.5 255.255.240.0
!
interface Loopback15
ip address 10.6.6.6 255.255.248.0
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
duplex auto
speed auto
media-type rj45
!
router eigrp 12
network 10.0.0.0
network 172.16.0.0 0.0.3.255
network 192.168.12.0
!
end
hostname R1
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
router eigrp 12
distribute-list prefix RENETEST3 in
network 192.168.12.0
!
ip prefix-list ALL seq 5 permit 0.0.0.0/0 le 32
!
ip prefix-list CLASSA seq 5 permit 0.0.0.0/1 le 27
!
ip prefix-list CLASSB seq 5 permit 128.0.0.0/2 ge 17
!
ip prefix-list DEFAULTROUTE seq 5 permit 0.0.0.0/0
!
ip prefix-list FILTERTHIS seq 5 deny 172.16.1.0/24
ip prefix-list FILTERTHIS seq 10 permit 0.0.0.0/0 le 32
!
ip prefix-list RENETEST seq 5 permit 10.0.0.0/8 le 19
!
ip prefix-list RENETEST2 seq 5 permit 10.0.0.0/8 ge 20
!
ip prefix-list RENETEST3 seq 5 permit 10.0.0.0/8 ge 16 le 18
!
end
268 | P a g e
I hope you now have a better understanding of prefix-lists. Don’t just read this lesson
and forget about it, it’s best to boot up your own routers and configure some prefix-lists.
If you have any more questions please leave a comment!
Route-Map Filtering
We only need two routers for this demonstration. R1 has some networks that it will
advertise to R2 through EIGRP. Here’s what the routing table of R2 looks like:
Above you see that R2 has learned all networks behind R1. Let’s start with something
simple…let’s say we want to configure R1 so that 192.168.1.0 /24 won’t be advertised to
R2. Here’s how we do this:
R1(config)#router eigrp 1
R1(config-router)#distribute-list ?
<1-199> IP access list number
<1300-2699> IP expanded access list number
WORD Access-list name
gateway Filtering incoming updates based on gateway
prefix Filter prefixes in routing updates
route-map Filter prefixes based on the route-map
We have to use the distribute-list command under the EIGRP process but as you can
see it supports a route-map. Let’s use that and give it a name:
269 | P a g e
in Filter incoming routing updates
out Filter outgoing routing updates
R1(config)#route-map FILTER_OUT ?
<0-65535> Sequence to insert to/delete from existing route-map entry
deny Route map denies set operations
permit Route map permits set operations
<cr>
The route-map will require a match statement. There are a lot of things you can select
for the match statement:
R1(config-route-map)#match ?
as-path Match BGP AS path list
clns CLNS information
community Match BGP community list
extcommunity Match BGP/VPN extended community list
interface Match first hop interface of route
ip IP specific information
ipv6 IPv6 specific information
length Packet length
local-preference Local preference for route
metric Match metric of route
mpls-label Match routes which have MPLS labels
nlri BGP NLRI type
policy-list Match IP policy list
route-type Match route-type of route
source-protocol Match source-protocol of route
tag Match tag of route
Not all of these options are possible when you use the route-map for filtering. Let’s start
with a simple example, let’s look at the IP options:
R1(config-route-map)#match ip address ?
<1-199> IP access-list number
<1300-2699> IP access-list number (expanded range)
WORD IP access-list name
270 | P a g e
prefix-list Match entries of prefix-lists
<cr>
The route-map is almost complete. We have a deny statement that matches everything
in our access-list. There’s one problem though, our route-map doesn’t have any permit
statements. If we don’t add one then everything will be blocked. Let’s add it:
This permit statement doesn’t require any matches. Let me show you an overview of our
configuration so far:
Above you can see that the route-map is attached to the distribute-list command in
EIGRP. Our route-map will deny everything that matches our access-list while
everything else is permitted. Let’s take a look at R2 to see if this works:
271 | P a g e
D 172.16.0.0/24 [90/409600] via 192.168.12.1, 00:01:01, FastEthernet0/0
D 172.16.1.0/25 [90/409600] via 192.168.12.1, 00:01:01, FastEthernet0/0
D 172.16.2.0/26 [90/409600] via 192.168.12.1, 00:01:01, FastEthernet0/0
D 172.16.3.0/27 [90/409600] via 192.168.12.1, 00:01:01, FastEthernet0/0
That’s looking good, everything is in the routing table except 192.168.1.0 /24. Now you
might be thinking that this was a lot of work just to filter one network…
You are right, this was a lot of work. The power of using a route-map for filtering is that
we can use multiple statements and use a mix of filtering techniques.
For example let’s say that we also want to deny all prefixes in the 172.16.0.0 /16 range
that use a /26 subnet or smaller subnet. We can do this by creating a prefix-list and
attaching it to our route-map:
Above I changed route-map entry 20 to a deny statement that checks for our prefix-list
called “SMALL_PREFIXES”. The last permit statement (sequence number 30) doesn’t
have any match statements and is required to permit all other route advertisements.
Here’s what the complete route-map looks like:
R1#show route-map
route-map FILTER_OUT, deny, sequence 10
Match clauses:
ip address (access-lists): NET_192
Set clauses:
Policy routing matches: 0 packets, 0 bytes
route-map FILTER_OUT, deny, sequence 20
Match clauses:
ip address prefix-lists: SMALL_PREFIXES
Set clauses:
Policy routing matches: 0 packets, 0 bytes
route-map FILTER_OUT, permit, sequence 30
Match clauses:
Set clauses:
Policy routing matches: 0 packets, 0 bytes
Our first sequence number (10) is used to filter with an access-list, the second one (20)
uses our prefix-list and the last one (30) permits everything else. Let’s check the result of
R2:
272 | P a g e
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
D 172.16.0.0/24 [90/409600] via 192.168.12.1, 00:38:18, FastEthernet0/0
D 172.16.1.0/25 [90/409600] via 192.168.12.1, 00:38:18, FastEthernet0/0
Great, as you can see network 172.16.2.0 /26 and 172.16.3.0 /27 are gone fishing, they
have been filtered because of the prefix-list. I think this example should give you a good
idea about the flexibility of a route-map, you can use a variety of filtering techniques.
Let’s try one more thing…we can also use a route-map for inbound filtering. Let’s filter
network 1.1.1.0 /24 on R2, to keep things interesting I’ll use the route-map in a different
way:
First we create an access-list. This access-list denies 1.1.1.0 /24 and permits everything
else. Now we create the route-map:
This route-map has only one permit statement. Everything that matches our access-list
will be permitted. Let’s attach it to EIGRP:
R2(config)#router eigrp 1
R2(config-router)#distribute-list route-map FILTER_IN in
As you can see 1.1.1.0 /24 is not in the routing table anymore.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface Loopback1
ip address 172.16.0.1 255.255.255.0
!
273 | P a g e
interface Loopback2
ip address 172.16.1.1 255.255.255.128
!
interface Loopback3
ip address 172.16.2.1 255.255.255.192
!
interface Loopback4
ip address 172.16.3.1 255.255.255.224
!
interface Loopback5
ip address 192.168.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
router eigrp 1
distribute-list route-map FILTER_OUT out
network 1.0.0.0
network 172.16.0.0 0.0.3.255
network 192.168.1.0
network 192.168.12.0
!
ip access-list standard NET_192
permit 192.168.1.0 0.0.0.255
!
ip prefix-list SMALL_PREFIXES seq 5 permit 172.16.0.0/16 ge 26
!
route-map FILTER_OUT deny 10
match ip address NET_192
!
route-map FILTER_OUT deny 20
match ip address prefix-list SMALL_PREFIXES
!
route-map FILTER_OUT permit 30
!
end
hostname R2
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
router eigrp 1
distribute-list route-map FILTER_IN in
network 192.168.12.0
!
ip access-list standard NET_1
deny 1.1.1.0 0.0.0.255
permit any
!
route-map FILTER_IN permit 10
match ip address NET_1
!
end
274 | P a g e
That’s all there is to it. I hope these examples have been useful to understand EIGRP
filtering with a route-map. If you have any questions, feel free to leave a comment.
OSPF supports a number of methods to filter routes but it is more restrictive compared
to distance vector routing protocols like RIP or EIGRP.
As a link-state routing protocol OSPF uses LSAs to build its LSDB (Link State
Database). Routers will run the SPF algorithm to find the shortest path to each
destination, the topology in the LSDB has to be the same on all routers or SPF will fail.
However OSPF routers only know what the topology looks like within the area. They
don’t know what the topology looks like for other areas. For inter-area routes OSPF only
knows the prefix and the ABR (Area Border Router) to reach it.
You could say that OSPF acts like a distance vector routing protocol for inter-area
routes. It only knows the metric (distance) and the ABR to get there (vector).
Unlike RIP or EIGRP, OSPF doesn’t advertise routes but LSAs so if we want to filter
something we’ll have to filter the advertisement of LSAs.
Since the LSDB within the area has to be the same we can’t filter LSAs within the
area, we can however filter routes from entering the routing table. Filtering LSAs
between areas on an ABR or ASBR is no problem.
In this lesson I’ll show you how we can filter routes from entering the routing table within
the area. In other lessons I will explain how to filter type 3 LSAs and type 5 LSAs.
Nothing fancy, we have three routers running OSPF in the same area. R1 has a
loopback interface that is advertised in OSPF, we’ll see if we can filter this network.
1. Configuration
Here’s the OSPF configuration:
275 | P a g e
network 192.168.23.0 0.0.0.255 area 0
R3#show running-config | section ospf
router ospf 1
network 192.168.23.0 0.0.0.255 area 0
R3(config)#router ospf 1
R3(config-router)#distribute-list ?
<1-199> IP access list number
<1300-2699> IP expanded access list number
WORD Access-list name
gateway Filtering incoming updates based on gateway
prefix Filter prefixes in routing updates
route-map Filter prefixes based on the route-map
We can use a distribute-list for this, to keep it simple I’ll combine it with an access-list;
R3(config-router)#distribute-list R1_L0 in
When we want to remove something from the routing table we have to apply it inbound.
The outbound distribute-list is used for LSA type 5 filtering.
Let’s create that access-list:
276 | P a g e
R3#show ip ospf database router 192.168.12.1
LS age: 664
Options: (No TOS-capability, DC)
LS Type: Router Links
Link State ID: 192.168.12.1
Advertising Router: 192.168.12.1
LS Seq Number: 80000003
Checksum: 0xF14F
Length: 48
Number of Links: 2
You have to be very careful if you use this command. If you are not careful you can end
up in a scenario where you blackhole some traffic. For example, let’s see what happens
when I filter this network on R2 instead of R3. Let’s remove the distribute-list on R3:
R3(config)#router ospf 1
R3(config-router)#no distribute-list R1_L0 in
R2(config)#router ospf 1
R2(config-router)#distribute-list R1_L0 in
277 | P a g e
However the LSA is still flooded to R3:
R3#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
router ospf 1
network 1.1.1.0 0.0.0.255 area 0
network 192.168.12.0 0.0.0.255 area 0
!
end
hostname R2
!
ip cef
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
interface FastEthernet1/0
ip address 192.168.23.2 255.255.255.0
!
router ospf 1
network 192.168.12.0 0.0.0.255 area 0
network 192.168.23.0 0.0.0.255 area 0
278 | P a g e
distribute-list R1_L0 in
!
ip access-list standard R1_L0
deny 1.1.1.1
permit any
!
end
hostname R3
!
ip cef
!
interface FastEthernet0/0
ip address 192.168.23.3 255.255.255.0
!
router ospf 1
network 192.168.23.0 0.0.0.255 area 0
!
ip access-list standard R1_L0
deny 1.1.1.1
permit any
!
end
That’s all there is to it, you have now seen how you can filter routes within your OSPF
area. Make sure you also check my other two lessons on OSPF filtering:
OSPF LSA type 3 filtering
OSPF LSA type 5 filtering
OSPF uses LSA type 3 for inter-area prefixes and if you want, you can filter these
between OSPF areas. Since you can only filter between areas you’ll have to configure
this on the ABR. Filtering is possible inbound or outbound an area by using the
area filter-list command.
In this lesson I will demonstrate how you can use this command to filter LSA type 3
between different areas. This is the topology that I will be using:
279 | P a g e
R1,R2 and R3 are located in their corresponding area number and have a loopback 0
interface each. The prefix on this loopback will be advertised in OSPF. In the middle you
can see which is the ABR for area 1,2 and 3. We’ll create some filter on R4 to
demonstrate the area filter-list command. Let me show you the OSPF configuration first:
R1(config)#router ospf 1
R1(config-router)#network 1.1.1.1 0.0.0.0 area 1
R1(config-router)#network 192.168.14.0 0.0.0.255 area 1
R2(config)#router ospf 1
R2(config-router)#network 2.2.2.2 0.0.0.0 area 2
R2(config-router)#network 192.168.24.0 0.0.0.255 area 2
R3(config)#router ospf 1
R3(config-router)#network 3.3.3.3 0.0.0.0 area 3
R3(config-router)#network 192.168.34.0 0.0.0.255 area 3
R4(config)#router ospf 1
R4(config-router)#network 4.4.4.4 0.0.0.0 area 0
R4(config-router)#network 192.168.14.0 0.0.0.255 area 1
R4(config-router)#network 192.168.24.0 0.0.0.255 area 2
R4(config-router)#network 192.168.34.0 0.0.0.255 area 3
Before we continue it’s best to verify that we have working OSPF neighbor adjacencies:
The ABR has 3 working OSPF neighbor adjacencies. Now it’s time to create some
filters. We’ll start with inbound filtering.
280 | P a g e
2. Inbound Area LSA Type 3 filtering
I will start by filtering some prefixes that are headed towards area 3. The inbound filter
will filter prefixes from all areas that are sent to 1 area. First we’ll take a look at the
routing table of R3 in area 3:
All prefixes that R3 has learned are inter-area prefixes (LSA Type 3). Let’s filter
2.2.2.2 /32 from entering area 3. First we’ll create a prefix-list:
This prefix-list will deny 2.2.2.2 /32 and allow all other prefixes. Now we have to apply it
to the area:
R4(config)#router ospf 1
R4(config-router)#area 3 filter-list prefix INTO-AREA3 in
If you want you can verify that the area filter is active with the show ip ospf command:
281 | P a g e
R3#show ip route ospf
1.0.0.0/32 is subnetted, 1 subnets
O IA 1.1.1.1 [110/3] via 192.168.34.4, 00:07:19, FastEthernet0/0
4.0.0.0/32 is subnetted, 1 subnets
O IA 4.4.4.4 [110/3] via 192.168.34.4, 00:07:19, FastEthernet0/0
O IA 192.168.14.0/24 [110/2] via 192.168.34.4, 00:07:19, FastEthernet0/0
O IA 192.168.24.0/24 [110/2] via 192.168.34.4, 00:07:19, FastEthernet0/0
Prefix 2.2.2.2 /32 is gone from the routing table as it has been filtered by the ABR (R4).
The nice thing about inbound filtering is that it doesn’t matter from which area the prefix
came, everything that goes into area 3 will hit the prefix-list and will be filtered. I can
demonstrate this to you by filtering something else, for example the two prefixes
192.168.14.0 /24 (area 1) and 192.168.24.0 /24 (area 2). Let’s change our prefix-list:
The 192.168.14.0 /24 and 192.168.24.0 /24 prefixes are now gone from the routing
table. It doesn’t matter from which area they come from…
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.14.1 255.255.255.0
!
router ospf 1
network 1.1.1.1 0.0.0.0 area 1
network 192.168.14.0 0.0.0.255 area 1
!
end
hostname R2
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
282 | P a g e
interface FastEthernet0/0
ip address 192.168.24.2 255.255.255.0
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 2
network 192.168.24.0 0.0.0.255 area 2
!
end
hostname R3
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.34.3 255.255.255.0
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 3
network 192.168.34.0 0.0.0.255 area 3
!
end
hostname R4
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.14.4 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.24.4 255.255.255.0
!
interface FastEthernet1/0
ip address 192.168.34.4 255.255.255.0
!
router ospf 1
area 3 filter-list prefix INTO-AREA3 in
network 4.4.4.4 0.0.0.0 area 0
network 192.168.14.0 0.0.0.255 area 1
network 192.168.24.0 0.0.0.255 area 2
network 192.168.34.0 0.0.0.255 area 3
!
end
Now you know how inbound filtering works, let’s take a look at outbound filtering.
283 | P a g e
R1#show ip route 3.3.3.3
Routing entry for 3.3.3.3/32
Known via "ospf 1", distance 110, metric 3, type inter area
Last update from 192.168.14.4 on FastEthernet0/0, 00:03:07 ago
Routing Descriptor Blocks:
* 192.168.14.4, from 4.4.4.4, 00:03:07 ago, via FastEthernet0/0
Route metric is 3, traffic share count is 1
R1 and R2 both know about the loopback interface of R3. Let’s create a prefix-list that
matches 3.3.3.3 /32:
We’ll deny 3.3.3.3 /32 and permit all other prefixes. Now activate it for area 3:
R4(config)#router ospf 1
R4(config-router)#area 3 filter-list prefix OUT-AREA3 out
This will ensure that all other areas won’t learn about 3.3.3.3 /32 once it leaves area 3.
R1 and R2 won’t know about this network anymore…
Want to take a look for yourself? Here you will find the startup configuration of each
device.
284 | P a g e
hostname R1
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.14.1 255.255.255.0
!
router ospf 1
network 1.1.1.1 0.0.0.0 area 1
network 192.168.14.0 0.0.0.255 area 1
!
end
hostname R2
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.24.2 255.255.255.0
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 2
network 192.168.24.0 0.0.0.255 area 2
!
end
hostname R3
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.34.3 255.255.255.0
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 3
network 192.168.34.0 0.0.0.255 area 3
!
end
hostname R4
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.14.4 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.24.4 255.255.255.0
285 | P a g e
!
interface FastEthernet1/0
ip address 192.168.34.4 255.255.255.0
!
router ospf 1
area 3 filter-list prefix INTO-AREA3 in
area 3 filter-list prefix OUT-AREA3 out
network 4.4.4.4 0.0.0.0 area 0
network 192.168.14.0 0.0.0.255 area 1
network 192.168.24.0 0.0.0.255 area 2
network 192.168.34.0 0.0.0.255 area 3
!
end
I hope this has been useful for you to understand OSPF’s capability to filter LSA type 3
prefixes. If you have any questions feel free to leave a comment.
In previous lessons I explained how you can filter routes within the OSPF area and how
you can filter type 3 LSAs. This time we’ll take a look how you can filter type 5 LSAs
using three different methods.
Here’s the topology we will use for this:`
Above we have three routers in two different areas. R1 has some loopback interfaces
that we will redistribute into OSPF. We’ll use these to play with some of the filtering
techniques.
1. Configuration
Here’s the OSPF configuration of all routers:
286 | P a g e
network 192.168.23.0 0.0.0.255 area 1
We will use an outbound distribute-list with an access-list that matches the network (host
route). Let’s see if it works:
287 | P a g e
O E2 172.16.2.1 [110/20] via 192.168.12.1, 00:10:12, FastEthernet0/0
O E2 172.16.3.1 [110/20] via 192.168.12.1, 00:10:12, FastEthernet0/0
The entry has disappeared from the routing tables of R2 and R3.
We’ll create a route-map that denies 172.16.1.1 /32 from being redistributed while we
allow everything else. When it’s finished we’ll attach it to the redistribute command
above:
The route-map above will deny 172.16.1.1 /32 and permits everything else. After
attaching it to the redistribute command you’ll see this on R2 and R3:
288 | P a g e
172.16.0.0/32 is subnetted, 2 subnets
O E2 172.16.2.1 [110/20] via 192.168.23.2, 00:00:07, FastEthernet0/0
O E2 172.16.3.1 [110/20] via 192.168.23.2, 00:00:07, FastEthernet0/0
O IA 192.168.12.0/24 [110/2] via 192.168.23.2, 00:20:34, FastEthernet0/0
It’s gone from the routing table…mission accomplished! Let’s take a look at the final
method…
1.3. Summary No-Advertise
The last method to filter a type 5 LSA is a nice trick that you can do with the summary-
address command. Let me show you how to use this to filter 172.16.2.1 /32:
R1(config)#router ospf 1
R1(config-router)#summary-address 172.16.2.1 255.255.255.255 not-advertise
2. Conclusion
You have now seen three different methods how you can get rid of type 5 LSAs. Another
method that prevents LSA type 5 from entering the area is using a stub area.
Be careful what filtering technique you use if you learn this for a CCIE R&S lab. The
devil is in the details…the distribute-list is actually filtering the network while the route-
map and summary-address prevent the router from advertising something.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
ip cef
!
interface Loopback0
ip address 172.16.0.1 255.255.255.255
!
289 | P a g e
interface Loopback1
ip address 172.16.1.1 255.255.255.255
!
interface Loopback2
ip address 172.16.2.1 255.255.255.255
!
interface Loopback3
ip address 172.16.3.1 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
!
router ospf 1
summary-address 172.16.2.1 255.255.255.255 not-advertise
redistribute connected subnets route-map CONNECTED_TO_OSPF
network 192.168.12.0 0.0.0.255 area 0
distribute-list R1_L0 out
!
ip access-list standard R1_L0
deny 172.16.0.1
permit any
ip access-list standard R1_L1
permit 172.16.1.1
!
route-map CONNECTED_TO_OSPF deny 10
match ip address R1_L1
!
route-map CONNECTED_TO_OSPF permit 20
!
end
hostname R2
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.23.2 255.255.255.0
!
router ospf 1
network 192.168.12.0 0.0.0.255 area 0
network 192.168.23.0 0.0.0.255 area 1
!
end
hostname R3
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.23.3 255.255.255.0
!
290 | P a g e
router ospf 1
network 192.168.23.0 0.0.0.255 area 1
!
end
Nowadays we use prefix-lists to filter BGP prefixes. Prefix-lists are very convenient since
they allow you to specify a network address with a specific prefix length or a range of
prefix lengths. Back in the days, before prefix-lists existed on Cisco IOS you had to use
extended access-lists for this.
You really don’t want to use these anymore since the prefix-list does the same thing and
the configuration is much easier. However, when you face a CCIE lab it might be
possible that a task requires you to filter certain prefixes, but you are not allowed to use
the prefix-list. The extended access-list will be your only option then…
Having said that, let’s take a look how extended access-list filtering works. The
“behavior” of the extended access-list is different compared to when you use it for
filtering IP packets.
When you use IP as the protocol, here’s what the extended access-list normally looks
like:
Above you see the source address with the source wildcard bits and the destination
address with destination wildcard bits. Now forget what you have seen above, this is
how the extended access-list works for BGP filtering:
291 | P a g e
1. Configuration
I will use the following two routers for this:
R2 has a bunch of loopback interfaces with different networks, we’ll use these to play
with filtering.
Here’s what R2 advertises to R1:
292 | P a g e
*> 192.168.7.24/30 0.0.0.0 0 32768 i
*> 192.168.12.0 0.0.0.0 0 32768 i
R1(config)#router bgp 1
R1(config-router)#distribute-list 100 in
R1#clear ip bgp *
R1#show ip bgp
BGP table version is 4, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
293 | P a g e
In my BGP table, you can see R1 is unable to install these prefixes because of a RIB-
failure. This seems to occur because the router refuses to use the next hop IP address
unless you permit it. I couldn’t find anything about this in the Cisco documentation, but
you can solve it by adding this statement to access-list 100: permit ip host
192.168.12.2 any
One little “extra” that the access-list offers us that the prefix-list doesn’t is that it shows
matches:
We only want to see 192.168.0.0 /24, 192.168.1.0 /24 and 192.168.12.0 /24 on R1.
Here’s the access-list we will create:
R1(config)#router bgp 1
R1(config-router)#distribute-list 101 in
R1#clear ip bgp *
294 | P a g e
The wildcard is 0.0.255.0 which means the 1st, 2nd and 4th octet have to match.
We don’t care about the 3rd octet.
The subnet mask is 255.255.255.0 and this has to match exactly which is why we
use a 0.0.0.0 wildcard.
Here’s the result:
R1#show ip bgp
BGP table version is 4, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
Great, these are the only 192.168.x.0 /24 networks that we have. Time for the next
example…
295 | P a g e
The network we want to check is 10.0.0.0 but we only care about the 1st and 4th
octet, the 2nd and 3rd octet can be everything, so we use wildcard 0.255.255.0.
We want all networks with a /24 prefix length, so we use 255.255.255.0 as the
subnet mask. This has to be an exact match, so we use 0.0.0.0 as the wildcard.
Here’s what we get:
R1#show ip bgp
BGP table version is 6, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
Great, these are all networks in the 10.x.x.0 range with a /24 prefix length. Let’s try
something else…
R1(config)#router bgp 1
R1(config-router)#distribute-list 103 in
R1#clear ip bgp *
296 | P a g e
Let me explain the access-list:
We want to check the 10.0.0.0 network, but we don’t care about the 2nd, 3th or
4th octet. That’s why we use a 0.255.255.255 wildcard.
The subnet mask is 255.255.255.128 which equals /25. It has to be an exact
match, so we use wildcard 0.0.0.0.
Here’s what you will find:
R1#show ip bgp
BGP table version is 5, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
Excellent, these are all 10.x.x.x networks with a /25 prefix length.
R1(config)#router bgp 1
R1(config-router)#distribute-list 104 in
R1#clear ip bgp *
297 | P a g e
We don’t care about the prefix length, it should be at least a /24 since we are
looking at the 192.168.7.x range, but it doesn’t matter if it’s a /25, /26, etc. This is
why we use subnet mask 255.255.255.0 with wildcard 0.0.0.255. It means that
we don’t care about the prefix length in the 4th octet.
Here’s the result:
R1#show ip bgp
BGP table version is 5, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
R1 will only have these networks in its BGP table now, everything else will be filtered.
298 | P a g e
*> 172.16.3.0/25 0.0.0.0 0 32768 i
*> 172.16.4.0/26 0.0.0.0 0 32768 i
*> 172.16.5.0/27 0.0.0.0 0 32768 i
*> 172.16.6.0/28 0.0.0.0 0 32768 i
*> 172.16.7.0/29 0.0.0.0 0 32768 i
*> 192.168.0.0 0.0.0.0 0 32768 i
*> 192.168.1.0 0.0.0.0 0 32768 i
*> 192.168.2.0/25 0.0.0.0 0 32768 i
*> 192.168.3.0/25 0.0.0.0 0 32768 i
*> 192.168.4.0/26 0.0.0.0 0 32768 i
*> 192.168.5.0/27 0.0.0.0 0 32768 i
*> 192.168.6.0/28 0.0.0.0 0 32768 i
*> 192.168.7.0/29 0.0.0.0 0 32768 i
*> 192.168.7.8/29 0.0.0.0 0 32768 i
*> 192.168.7.16/29 0.0.0.0 0 32768 i
*> 192.168.7.24/30 0.0.0.0 0 32768 i
*> 192.168.12.0 0.0.0.0 0 32768 i
We have a big list with prefixes, most of them have a prefix length that is larger than /24.
We do have 20.0.0.0 /8 and 30.0.0.0 /8 that will be gone when we create this filter. Time
to find out:
R1(config)#router bgp 1
R1(config-router)#distribute-list 105 in
R1#clear ip bgp *
R1#show ip bgp
BGP table version is 33, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
299 | P a g e
r> 10.3.0.128/25 192.168.12.2 0 0 2 i
r> 10.4.0.0/25 192.168.12.2 0 0 2 i
r> 10.4.0.128/25 192.168.12.2 0 0 2 i
r> 10.5.0.0/26 192.168.12.2 0 0 2 i
r> 10.6.0.0/27 192.168.12.2 0 0 2 i
r> 10.7.0.0/28 192.168.12.2 0 0 2 i
r> 10.8.1.0/24 192.168.12.2 0 0 2 i
r> 10.8.2.0/24 192.168.12.2 0 0 2 i
r> 172.16.0.0/24 192.168.12.2 0 0 2 i
r> 172.16.1.0/24 192.168.12.2 0 0 2 i
r> 172.16.2.0/25 192.168.12.2 0 0 2 i
r> 172.16.3.0/25 192.168.12.2 0 0 2 i
r> 172.16.4.0/26 192.168.12.2 0 0 2 i
r> 172.16.5.0/27 192.168.12.2 0 0 2 i
r> 172.16.6.0/28 192.168.12.2 0 0 2 i
r> 172.16.7.0/29 192.168.12.2 0 0 2 i
r> 192.168.0.0 192.168.12.2 0 0 2 i
r> 192.168.1.0 192.168.12.2 0 0 2 i
r> 192.168.2.0/25 192.168.12.2 0 0 2 i
r> 192.168.3.0/25 192.168.12.2 0 0 2 i
r> 192.168.4.0/26 192.168.12.2 0 0 2 i
r> 192.168.5.0/27 192.168.12.2 0 0 2 i
r> 192.168.6.0/28 192.168.12.2 0 0 2 i
r> 192.168.7.0/29 192.168.12.2 0 0 2 i
r> 192.168.7.8/29 192.168.12.2 0 0 2 i
r> 192.168.7.16/29 192.168.12.2 0 0 2 i
r> 192.168.7.24/30 192.168.12.2 0 0 2 i
r> 192.168.12.0 192.168.12.2 0 0 2 i
Our 20.0.0.0 /8 and 30.0.0.0 /8 prefixes are now gone from the BGP table, everything
you see above has at least a /24 prefix length.
300 | P a g e
*> 10.8.1.0/24 0.0.0.0 0 32768 i
*> 10.8.2.0/24 0.0.0.0 0 32768 i
*> 20.0.0.0 0.0.0.0 0 32768 i
*> 30.0.0.0 0.0.0.0 0 32768 i
*> 172.16.0.0/24 0.0.0.0 0 32768 i
*> 172.16.1.0/24 0.0.0.0 0 32768 i
*> 172.16.2.0/25 0.0.0.0 0 32768 i
*> 172.16.3.0/25 0.0.0.0 0 32768 i
*> 172.16.4.0/26 0.0.0.0 0 32768 i
*> 172.16.5.0/27 0.0.0.0 0 32768 i
*> 172.16.6.0/28 0.0.0.0 0 32768 i
*> 172.16.7.0/29 0.0.0.0 0 32768 i
*> 192.168.0.0 0.0.0.0 0 32768 i
*> 192.168.1.0 0.0.0.0 0 32768 i
*> 192.168.2.0/25 0.0.0.0 0 32768 i
*> 192.168.3.0/25 0.0.0.0 0 32768 i
*> 192.168.4.0/26 0.0.0.0 0 32768 i
*> 192.168.5.0/27 0.0.0.0 0 32768 i
*> 192.168.6.0/28 0.0.0.0 0 32768 i
*> 192.168.7.0/29 0.0.0.0 0 32768 i
*> 192.168.7.8/29 0.0.0.0 0 32768 i
*> 192.168.7.16/29 0.0.0.0 0 32768 i
*> 192.168.7.24/30 0.0.0.0 0 32768 i
*> 192.168.12.0 0.0.0.0 0 32768 i
R1(config)#router bgp 1
R1(config-router)#distribute-list 106 in
R1#clear ip bgp *
R1#show ip bgp
BGP table version is 15, local router ID is 192.168.12.1
301 | P a g e
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
Above you can see that all prefixes below /26 have disappeared.
1.8. Filter 172.16.x.x networks with a /27 to /32 prefix length
This example will be similar to the previous one with the exception that we will check a
specific network range. Here are all networks in the 172.16.x.x range that R2 offers us:
R1(config)#router bgp 1
R1(config-router)#distribute-list 107 in
R1#clear ip bgp *
302 | P a g e
The prefix length should be at least /27 so we use a subnet mask of
255.255.255.224.
We want to match all subnet masks from /27 to /32 so we use a wildcard of
0.0.0.31. This means the first three octets have to match and the last four bits of
the 4th octet. This will allow subnet mask 255.255.255.192, 255.255.255.224,
255.255.255.240, 255.255.255.248, 255.255.255.252, 255.255.255.254 and
255.255.255.255.
Here’s the end result:
R1#show ip bgp
BGP table version is 4, local router ID is 192.168.12.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
Great, we only have a few 172.16.x.x networks with a /27 prefix length or larger.
2. Conclusion
You have now seen quite some examples of how you can use BGP filtering with
extended access-lists. This can be pretty annoying and it’s much easier to use prefix-
lists instead. However if you are not allowed to use them, you now know how to filter
with extended access-lists.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
duplex auto
speed auto
!
router bgp 1
bgp log-neighbor-changes
neighbor 192.168.12.2 remote-as 2
distribute-list 107 in
!
access-list 100 permit ip host 20.0.0.0 host 255.0.0.0
access-list 100 permit ip host 172.16.0.0 host 255.255.255.0
access-list 100 permit ip host 192.168.1.0 host 255.255.255.0
access-list 101 permit ip 192.168.0.0 0.0.255.0 host 255.255.255.0
access-list 102 permit ip 10.0.0.0 0.255.255.0 host 255.255.255.0
access-list 103 permit ip 10.0.0.0 0.255.255.255 host 255.255.255.128
access-list 104 permit ip 192.168.7.0 0.0.0.255 255.255.255.0 0.0.0.255
access-list 105 permit ip any 255.255.255.0 0.0.0.255
303 | P a g e
access-list 106 permit ip any 255.255.255.192 0.0.0.63
access-list 107 permit ip 172.16.0.0 0.0.255.255 255.255.255.224 0.0.0.31
!
end
hostname R2
!
interface Loopback0
ip address 10.0.0.1 255.255.255.0
!
interface Loopback1
ip address 10.1.0.1 255.255.255.0
!
interface Loopback2
ip address 10.2.0.1 255.255.255.0
!
interface Loopback3
ip address 10.3.0.1 255.255.255.128
!
interface Loopback4
ip address 10.3.0.129 255.255.255.128
!
interface Loopback5
ip address 10.4.0.1 255.255.255.128
!
interface Loopback6
ip address 10.4.0.129 255.255.255.128
!
interface Loopback7
ip address 10.5.0.1 255.255.255.192
!
interface Loopback8
ip address 10.6.0.1 255.255.255.224
!
interface Loopback9
ip address 10.7.0.1 255.255.255.240
!
interface Loopback10
ip address 10.8.1.1 255.255.255.0
!
interface Loopback11
ip address 10.8.2.1 255.255.255.0
!
interface Loopback12
ip address 20.0.0.1 255.0.0.0
!
interface Loopback13
ip address 30.0.0.1 255.0.0.0
!
interface Loopback14
ip address 172.16.0.1 255.255.255.0
!
interface Loopback15
ip address 172.16.1.1 255.255.255.0
!
interface Loopback16
304 | P a g e
ip address 172.16.2.1 255.255.255.128
!
interface Loopback17
ip address 172.16.3.1 255.255.255.128
!
interface Loopback18
ip address 172.16.4.1 255.255.255.192
!
interface Loopback19
ip address 172.16.5.1 255.255.255.224
!
interface Loopback20
ip address 172.16.6.1 255.255.255.240
!
interface Loopback21
ip address 172.16.7.1 255.255.255.248
!
interface Loopback22
ip address 192.168.0.1 255.255.255.0
!
interface Loopback23
ip address 192.168.1.1 255.255.255.0
!
interface Loopback24
ip address 192.168.2.1 255.255.255.128
!
interface Loopback25
ip address 192.168.3.1 255.255.255.128
!
interface Loopback26
ip address 192.168.4.1 255.255.255.192
!
interface Loopback27
ip address 192.168.5.1 255.255.255.224
!
interface Loopback28
ip address 192.168.6.1 255.255.255.240
!
interface Loopback29
ip address 192.168.7.1 255.255.255.248
!
interface Loopback30
ip address 192.168.7.9 255.255.255.248
!
interface Loopback31
ip address 192.168.7.17 255.255.255.248
!
interface Loopback32
ip address 192.168.7.25 255.255.255.252
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
duplex auto
speed auto
!
router bgp 2
bgp log-neighbor-changes
network 10.0.0.0 mask 255.255.255.0
305 | P a g e
network 10.1.0.0 mask 255.255.255.0
network 10.2.0.0 mask 255.255.255.0
network 10.3.0.0 mask 255.255.255.128
network 10.3.0.128 mask 255.255.255.128
network 10.4.0.0 mask 255.255.255.128
network 10.4.0.128 mask 255.255.255.128
network 10.5.0.0 mask 255.255.255.192
network 10.6.0.0 mask 255.255.255.224
network 10.7.0.0 mask 255.255.255.240
network 10.8.0.0 mask 255.255.255.224
network 10.8.1.0 mask 255.255.255.0
network 10.8.2.0 mask 255.255.255.0
network 20.0.0.0
network 30.0.0.0
network 172.16.0.0 mask 255.255.255.0
network 172.16.1.0 mask 255.255.255.0
network 172.16.2.0 mask 255.255.255.128
network 172.16.3.0 mask 255.255.255.128
network 172.16.4.0 mask 255.255.255.192
network 172.16.5.0 mask 255.255.255.224
network 172.16.6.0 mask 255.255.255.240
network 172.16.7.0 mask 255.255.255.248
network 192.168.0.0
network 192.168.1.0
network 192.168.2.0 mask 255.255.255.128
network 192.168.3.0 mask 255.255.255.128
network 192.168.4.0 mask 255.255.255.192
network 192.168.5.0 mask 255.255.255.224
network 192.168.6.0 mask 255.255.255.240
network 192.168.7.0 mask 255.255.255.248
network 192.168.7.8 mask 255.255.255.248
network 192.168.7.16 mask 255.255.255.248
network 192.168.7.24 mask 255.255.255.252
network 192.168.12.0
neighbor 192.168.12.1 remote-as 1
!
end
Filtering IPv6 routes in BGP is similar to IPv4 filtering. There are 3 methods we can use:
Prefix-list
Filter-list
Route-map
Each of these can be applied in- or outbound. I’ll explain how you can use these for
filtering, this is the topology I will use:
306 | P a g e
R1 and R2 are using IPv6 addresses and will use MP-BGP so that R1 can advertise
some prefixes on its loopback interfaces. All prefixes on the loopback interfaces are /64
subnets while loopback3 has a /96 subnet.
1. Configuration
Let’s start with a basic MP-BGP configuration so that R1 and R2 become eBGP
neighbors:
R1 & R2#
(config)ipv6 unicast-routing
R1(config)#router bgp 1
R1(config-router)#bgp router-id 1.1.1.1
R1(config-router)#neighbor 2001:db8:0:12::2 remote-as 2
R1(config-router)#address-family ipv6
R1(config-router-af)#neighbor 2001:db8:0:12::2 activate
R1(config-router-af)#network 2001:db8:0:1::/64
R1(config-router-af)#network 2001:db8:0:11::/64
R1(config-router-af)#network 2001:db8:0:111::/64
R1(config-router-af)#network 2001:db8:0:1111::/96
R2(config)#router bgp 2
R2(config-router)#bgp router-id 2.2.2.2
R2(config-router)#neighbor 2001:db8:0:12::1 remote-as 1
R2(config-router)#address-family ipv6
R2(config-router-af)#neighbor 2001:db8:0:12::1 activate
There we go, everything is in the routing table. Now we can play with some of the
filtering options…
This prefix-list checks the entire 2001::/16 range and permits subnets with a /64 or
larger. Anything smaller will be denied. Let’s activate it:
307 | P a g e
R2(config)#router bgp 2
R2(config-router)#address-family ipv6
R2(config-router-af)#neighbor 2001:db8:0:12::1 prefix-list SMALL_NETWORKS in
We activate the prefix-list inbound on R2 for everything that we receive from R1. Let’s
reset BGP to speed things up:
R2#clear ip bgp *
R1(config)#router bgp 1
R1(config-router)#address-family ipv6
R1(config-router-af)#neighbor 2001:db8:0:12::2 route-map PREPEND out
The above configuration will make sure that whenever R1 advertises 2001:db8:0:1::/64 it
will add AS 11 to the AS path. Let’s verify this:
308 | P a g e
r RIB-failure, S Stale, m multipath, b backup-path, x best-external,
f RT-Filter
Origin codes: i - IGP, e - EGP, ? - incomplete
Above you can see that 2001:DB8:0:1::/64 now has AS 11 in its AS path. Let’s configure
a filter-list on R2 to get rid of this network:
R2(config)#router bgp 2
R2(config-router)#address-family ipv6
R2(config-router-af)#neighbor 2001:db8:0:12::1 filter-list 11 in
R2#clear ip bgp *
The as-path access-list above only permits prefixes from AS1, nothing else. We attach it
inbound to everything we receive from R1. This is the result:
309 | P a g e
R2(config)#router bgp 2
R2(config-router-af)#neighbor 2001:db8:0:12::1 route-map MY_FILTER in
R2#clear ip bgp *
The access-list tells us that it has a match and you can see it’s gone from the routing
table.
2. Order of Operation
You have now seen how you can use a prefix-list, filter-list and route-map to filter IPv6
prefixes. You can apply all of these at the same time if you want, I didn’t remove any of
my previous configurations when I was writing this lesson. Take a look at R2:
R2#show run | sec address-family ipv6
address-family ipv6
neighbor 2001:DB8:0:12::1 activate
neighbor 2001:DB8:0:12::1 prefix-list SMALL_NETWORKS in
neighbor 2001:DB8:0:12::1 route-map MY_FILTER in
neighbor 2001:DB8:0:12::1 filter-list 11 in
On a production network you probably won’t use all of these at the same time. The
route-map is a popular choice since you can use it for pretty much anything, filtering and
doing things like prepending the AS path.
If you do activate all of these at the same time then you might want to know in what
order the router will process these filtering techniques. Here they are:
Inbound:
Route-map
Filter-List
Prefix-List
Outbound:
Prefix-List
Filter-List
Route-Map
310 | P a g e
Why do we care about this? Imagine you have an inbound route-map and prefix-list. If
you permitted a prefix in the prefix-list but denied it in the route-map then you will never
see the prefix in your BGP table since the route-map is processed before the prefix-list.
For outbound filtering it’s the other way around. If you permit something in the route-map
but denied it in a filter-list then it will never be advertised…the filter-list is processed
before the route-map for outbound updates.
Don’t make it too hard for yourself…it’s best to stick to using the route-map only since
you can attach prefix-lists and as-path access-lists to it.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
ipv6 unicast-routing
!
interface FastEthernet0/0
ipv6 address 2001:DB8:0:12::1/64
!
interface Loopback0
ipv6 address 2001:DB8:0:1::1/64
!
interface Loopback1
ipv6 address 2001:DB8:0:11::1/64
!
interface Loopback2
ipv6 address 2001:DB8:0:111::1/64
!
interface Loopback3
ipv6 address 2001:DB8:0:1111::1/96
!
router bgp 1
bgp router-id 1.1.1.1
bgp log-neighbor-changes
neighbor 2001:DB8:0:12::2 remote-as 2
!
address-family ipv4
neighbor 2001:DB8:0:12::2 activate
neighbor 2001:DB8:0:12::2 route-map PREPEND out
exit-address-family
!
address-family ipv6
network 2001:DB8:0:1::/64
network 2001:DB8:0:11::/64
network 2001:DB8:0:111::/64
network 2001:DB8:0:1111::/96
neighbor 2001:DB8:0:12::2 activate
neighbor 2001:DB8:0:12::2 route-map PREPEND out
exit-address-family
!
ipv6 prefix-list FIRST_LOOPBACK permit 2001:db8:0:1::/64
route-map PREPEND permit 10
match ipv6 address prefix-list FIRST_LOOPBACK
set as-path prepend 11
route-map PREPEND permit 20
311 | P a g e
!
end
hostname R2
!
ipv6 unicast-routing
!
interface FastEthernet0/0
ipv6 address 2001:DB8:0:12::2/64
!
router bgp 2
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 2001:DB8:0:12::1 remote-as 1
!
address-family ipv4
no neighbor 2001:DB8:0:12::1 activate
exit-address-family
!
address-family ipv6
neighbor 2001:DB8:0:12::1 activate
neighbor 2001:DB8:0:12::1 prefix-list SMALL_NETWORKS in
neighbor 2001:DB8:0:12::1 route-map MY_FILTER in
neighbor 2001:DB8:0:12::1 filter-list 11 in
exit-address-family
!
ipv6 prefix-list SMALL_NETWORKS permit 2001::/16 le 64
!
ip as-path access-list 11 permit ^1$
!
ipv6 access-list THIRD_LOOPBACK
permit 2001:db8:0:11::/64 any
!
route-map MY_FILTER deny 10
match ipv6 address THIRD_LOOPBACK
route-map MY_FILTER permit 20
!
end
312 | P a g e
1.2.g: Manual summarization with any routing protocol
Route summarization is a method where we create one summary route that represent
multiple networks/subnets. It’s also called route aggregation or supernetting.
Summarization has a number of advantages:
Forwarding traffic for unused networks: a router will drop traffic when it
doesn’t have a matching destination in its routing table. When we use
summarization, it’s possible that the summary route covers networks that are not
in use. The router that has a summary route will forward them to the router that
has advertised the summary route.
313 | P a g e
Sub-optimal routing: routers prefer the path with the longest prefix match. When
you use summaries, it’s possible that your router prefers another path where it
has learned a more specific network from. The summary route also has a single
metric.
This lesson doesn’t cover how to calculate summary routes. If that’s what you want to
learn, take a look here.
It’s best to see everything I described above in action. Let’s take a look at some routers.
1. Configuration
This is the topology we will use:
For now, we only need two routers. R1 has four loopback interfaces that we will
advertise in RIP. I’ll show you a “before” and “after” of route summarization.
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 172.16.0.0
R1(config-router)#network 192.168.12.0
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.12.0
Let’s enable a debug so that we can see what is going on behind the scenes:
R1 & R2
#debug ip rip
RIP protocol debugging is on
R1#
RIP: sending v2 update to 224.0.0.9 via GigabitEthernet0/1 (192.168.12.1)
RIP: build update entries
172.16.0.0/24 via 0.0.0.0, metric 1, tag 0
172.16.1.0/24 via 0.0.0.0, metric 1, tag 0
314 | P a g e
172.16.2.0/24 via 0.0.0.0, metric 1, tag 0
172.16.3.0/24 via 0.0.0.0, metric 1, tag 0
R2#
RIP: received v2 update from 192.168.12.1 on GigabitEthernet0/1
172.16.0.0/24 via 0.0.0.0 in 1 hops
172.16.1.0/24 via 0.0.0.0 in 1 hops
172.16.2.0/24 via 0.0.0.0 in 1 hops
172.16.3.0/24 via 0.0.0.0 in 1 hops
The more information we advertise, the more bandwidth we require, and more CPU
cycles are required to process them. Of course, four networks on a Gigabit interface are
no problem but in larger networks, there might be thousands or hundreds of thousands
of networks that are advertised.
Let’s check R2:
R1(config)#interface loopback 0
R1(config-if)#shutdown
R2#
RIP: received v2 update from 192.168.12.1 on GigabitEthernet0/1
172.16.0.0/24 via 0.0.0.0 in 16 hops (inaccessible)
315 | P a g e
After a while, R2 will remove this network from its routing table. Every time an interface
goes up and down, packets are generated, and the routing table will change. All of this
requires bandwidth, CPU cycles, and memory. No problem for our small network but
when you have thousands of networks and dozens of routers then it’s a different story.
Only one network is advertised, our summary route. Less information, less bandwidth,
less CPU cycles required and less memory. Here’s the routing table of R2:
Only one entry remains. R2 is still able to reach every network that our summary route
covers. Let’s try this:
R2#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/6 ms
This is looking good. Let me also show you one of the disadvantages of summarization.
Here’s what happens when we ping an IP address that is covered by the summary route,
but which is not available:
R2#ping 172.16.4.4
316 | P a g e
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.4.4, timeout is 2 seconds:
U.U.U
Success rate is 0 percent (0/5)
The U means it’s unreachable. R2 has a matching route towards R1 so it sends these
packets to R1. When R1 receives them, it drops them since it doesn’t have a matching
entry and informs R2 about this.
Remember what happened when we shut one of the loopback interface? RIP would
send a triggered update. Let’s try that again:
R1(config)#interface loopback 0
R1(config-if)#shutdown
Nothing will happen now! As long as there is one interface up with an IP address that
falls within the summary route then the summary will be advertised. This makes our
network far more stable.
Let me show you what happens when I shut the remaining loopbacks:
R1(config)#interface loopback 1
R1(config-if)#shutdown
R1(config)#interface loopback 2
R1(config-if)#shutdown
R1(config)#interface loopback 3
R1(config-if)#shutdown
R1#
RIP: sending v2 flash update to 224.0.0.9 via GigabitEthernet0/1 (192.168.12.1)
RIP: build flash update entries
172.16.0.0/16 via 0.0.0.0, metric 16, tag 0
Once the final loopback interface is gone, R1 sends the triggered update to inform R2
that the summary route is gone. Here’s R2:
R2#
RIP: received v2 update from 192.168.12.1 on GigabitEthernet0/1
172.16.0.0/16 via 0.0.0.0 in 16 hops (inaccessible)
There is one more disadvantage to summarization but to demonstrate this, I will have to
add another router. Let’s add R3:
317 | P a g e
We use the same topology but R1 and R2 are now also connected to R3. Let’s make
sure our loopback interfaces are up again:
R1(config)#router rip
R1(config-router)#network 192.168.13.0
R1(config)#router rip
R1(config-router)distribute-list 1 in GigabitEthernet 0/2
The access-list on R1 is required to prevent R1 from installing any RIP routes from R3.
Otherwise the summary route is advertised from R1 > R2 > R3 > R1, causing a routing
loop.
R2(config-if)#router rip
R2(config-router)#network 192.168.23.0
And R3:
R3(config-if)#router rip
R3(config-R3)#version 2
R3(config-R3)#no auto-summary
R3(config-R3)#network 192.168.13.0
R3(config-R3)#network 192.168.23.0
318 | P a g e
R3#show ip route rip
Above you can see that R3 learns the summary route from R2, all other networks are
learned from R1. Let’s check R2:
Above you can see that we now have sub-optimal routing on R2. Since the router
prefers the most specific path, it will use R3 to reach the four 172.16.x.0/24 networks
and it’s not using the summary route from R1. We can verify this with a traceroute:
There are a couple of different methods how you can solve this, depending on what
routing protocol you select. This is something we will discuss in other lessons.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
ip cef
!
interface Loopback0
ip address 172.16.0.1 255.255.255.0
!
interface Loopback1
ip address 172.16.1.1 255.255.255.0
319 | P a g e
!
interface Loopback2
ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
ip address 172.16.3.1 255.255.255.0
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
ip summary-address rip 172.16.0.0 255.255.0.0
!
interface GigabitEthernet0/2
ip address 192.168.13.1 255.255.255.0
!
router rip
network 172.16.0.0
network 192.168.12.0
network 192.168.13.0
distribute-list 1 in GigabitEthernet0/2
no auto-summary
!
access-list 1 deny any
!
end
hostname R2
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.23.2 255.255.255.0
!
router rip
network 192.168.12.0
network 192.168.23.0
no auto-summary
!
end
hostname R3
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.13.3 255.255.255.0
!
interface GigabitEthernet0/2
ip address 192.168.23.3 255.255.255.0
!
router rip
network 192.168.13.0
320 | P a g e
network 192.168.23.0
no auto-summary
!
end
2. Conclusion
You have now learned what route summarization is about and it’s advantages and
disadvantages:
Summarization means we advertise one summary route that represents multiple
networks.
Also known as route aggregation or supernetting.
Saves CPU cycles, bandwidth and memory.
Reduces the size of the routing table.
Prevents routing table instability
Has two possible disadvantages:
o Forwarding traffic to non-existing networks.
o Sub-optimal routing.
Route Summarization
In this lesson we’ll take a look how you can configure summaries. First I’ll show you
some examples how to do so in binary and then we’ll take a look at some tricks how you
can do it in decimal (which is much faster).
Let’s say we want to create the most optimal summary for the following 4 networks:
192.168.0.0 / 24 subnet mask 255.255.255.0
192.168.1.0 / 24 subnet mask 255.255.255.0
192.168.2.0 / 24 subnet mask 255.255.255.0
192.168.3.0 / 24 subnet mask 255.255.255.0
321 | P a g e
Now we have to look how many bits these network addresses have in common. The first
and second octets are the same, so that’s 16 bits.
Let’s zoom in on the third octet:
00000000
00000001
00000010
00000011
The first 6 bits of the third octet are the same. Now we have enough information to
create our summary address.
8 + 8 + 6 = 22 bits
Now you have seen how to do this in binary, let’s do it in decimal. There’s a simple trick
you can use to calculate this summary.
As you can see we have 4 networks, or when we speak in ‘blocks’ it’s a block of 4.
Here’s a formula you can use:
Another way to look at it is by using the CIDR notation. You know a /24 is a block of 256
addresses. Using a /23 means you have 2 x 256, and a /22 means you have 4 x 256.
Let’s look at another example. Let’s say we want to summarize the following networks:
172.16.0.0 / 16 subnet mask 255.255.0.0
172.17.0.0 / 16 subnet mask 255.255.0.0
172.18.0.0 / 16 subnet mask 255.255.0.0
172.19.0.0 / 16 subnet mask 255.255.0.0
172.20.0.0 / 16 subnet mask 255.255.0.0
172.21.0.0 / 16 subnet mask 255.255.0.0
172.22.0.0 / 16 subnet mask 255.255.0.0
172.23.0.0 / 16 subnet mask 255.255.0.0
Let’s look at it in binary first. I’ll write down the second octet since the first one is the
same for all network addresses:
322 | P a g e
16 00010000
17 00010001
18 00010010
19 00010011
20 00010100
21 00010101
22 00010110
23 00010111
The first 5 bits for all these addresses are the same. The first octet had 8 similar bits so
that’s 8 + 5 = 13 bits.
The summary address will be 172.16.0.0 /13 (subnet mask will be 255.248.0.0).
Calculating in binary like this works but it’s slow. Let’s use our trick for this:
In this lesson we’ll take a look at EIGRP summarization. The cool thing about EIGRP
and summarization is that it’s easy to do and can be done on the interface-level. Here’s
the topology that we’ll use:
323 | P a g e
Let’s create a basic EIGRP configuration:
R1(config)#router eigrp 1
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.12.0
R1(config-router)#network 172.16.0.0
R2(config)#router eigrp 1
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.12.0
Just a basic EIGRP configuration. This is what the routing table of R2 looks like:
Use the ip summary-address eigrp command to specify the summary. Now the routing
table will look like this:
The two networks disappear, and a single entry will appear on R2. The metric is 30720,
how did it get this value? When you advertise a summary, the router advertising the
summary will use the lowest metric of all networks that fall within the range of the
summary. That’s the one it will use for the summary. It is possible to manually set the
metric for each summary. Here’s how:
R1(config)#router eigrp 1
324 | P a g e
R1(config-router)#summary-metric ?
The summary-metric requires you to set the bandwidth, delay, reliability, load, and MTU.
Let’s try something:
EIGRP will create an entry in the routing table for the summary and it’s pointing to the
null0 interface. It does this to protect itself against routing loops. When you use
summaries it’s possible that other routers will send traffic to you for networks that you
have no clue about where they are. When this happens the traffic will be forwarded to
the null0 interface and dropped.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R2
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
router eigrp 1
network 192.168.12.0
!
end
hostname R1
!
interface FastEthernet2/0
ip address 192.168.12.1 255.255.255.0
ip summary-address eigrp 1 172.16.0.0 255.255.254.0
!
interface FastEthernet0/0
ip address 172.16.0.1 255.255.255.0
325 | P a g e
!
interface FastEthernet1/0
ip address 172.16.1.1 255.255.255.0
!
router eigrp 1
network 172.16.0.0
network 192.168.12.0
!
end
If you are studying OSPF you will learn that OSPF uses LSA type 3 for inter-area routers
and LSA type 5 for external prefixes that are redistributed into OSPF.
OSPF can do summarization but it’s impossible to summarize within an area. This
means we have to configure summarization on an ABR or ASBR. OSPF can only
summarize our LSA type 3 and 5.
If you want summarization for OSPF you will have to configure it yourself. I will show you
how to do this for inter-area prefixes and external prefixes. Let’s start with an example:
Look at the topology above. If we don’t use summarization (which is the default) there
will be a LSA for every specific prefix. If we have a link failure in area 1 then R1 (our
ABR) will flood a new type 3 summary LSA and this change has to be propagated
throughout all our OSPF areas. Since the LSDB will change our OSPF routers they will
have to re-run the SPF algorithm which takes time and CPU power.
If we use summarization things will be different. I can create a summary on R1 to
summarize the different type 3 summary LSAs. Instead of sending a LSA for 4.4.4.0 /24
and 4.5.5.0 /24 I could send 4.0.0.0 /8 or something alike.
If a link failure occurs in area 1 nothing will change for area 0 and area 2 since they don’t
have the specific 4.4.4.0 /24 prefix in their LSDB but the 4.0.0.0 /8 summary. Nothing will
change in their LSDB so we don’t have to re-run the SPF algorithm.
326 | P a g e
Summarization of type 3 summary LSAs means we are creating a summary of all the
interarea routes. This is why we call it interarea route summarization. There are a
couple of things to be aware of:
A summary route will only be advertised if you have at least one subnet that
falls within the summary range.
A summary route will have the cost of the subnet with the lowest cost that falls
within the summary range.
Your ABR that creates the summary route will create a null0 interface to prevent
loops.
OSPF is a classless routing protocol so you can pick any subnet mask you like
for prefixes.
If you look at my picture you can see that 4.4.4.0 /24 and 4.5.5.0 /24 both fall within the
4.0.0.0 /8 summary. If we have a link failure for the 4.4.4.0 /24 prefix we will still
advertise the summary. If 4.5.5.0 /24 would fail as well then the summary will be
withdrawn since there is no subnet left that falls within the 4.0.0.0 /8 range.
Enough theory let’s take a look at the configuration of inter-area summarization. This is
the topology we’ll use:
I’m going to show you an example of interarea route summarization. I’m going to use
routers R1 and R2. R1 will have 4 loopback interfaces which are in area 0. The link
between R1 and R2 is in area 1 which turns R1 into an ABR that can do summarization.
R1(config)#router ospf 1
R1(config-router)#network 172.16.0.0 0.0.3.255 area 0
R1(config-router)#network 192.168.12.0 0.0.0.255 area 1
R2(config)#router ospf 1
R2(config-router)#network 192.168.12.0 0.0.0.255 area 1
327 | P a g e
Summary Net Link States (Area 1)
Above you see the LSDB and routing table of R2. You can see there are 4 LSAs for
each of the prefixes.
R1(config)#router ospf 1
R1(config-router)#area 0 range 172.16.0.0 255.255.0.0
By using the area range command we can summarize the type 3 summary LSAs. In my
example I’m creating the summary 172.16.0.0 /16. To keep things interesting you need
to type in a subnet mask for the summary instead of a wildcard for the network
command.
Once again the LSDB and routing table of R2. Instead of 4x type 3 summary LSA we
now have just a single LSA. You can see there is only the 172.16.0.0 /16 entry in the
routing table.
So far so good? Excellent! One more thing we can do with OSPF and summarization
which is external route summarization. This is where we summarize the type 5
external LSAs. Two things to keep in mind:
You can create the summary only on the ASBR.
A null0 entry will be created in the routing table for the summary route.
This is the topology I will use to demonstrate this:
328 | P a g e
Instead of using the network command to advertise the prefixes on the loopback
interfaces I’m going to redistribute them into OSPF.
R1(config)#router ospf 1
R1(config-router)#no network 172.16.0.0 0.0.3.255 area 0
R1(config-router)#redistribute connected subnets
We’ll remove the network command for the interfaces and redistribute the loopback
interfaces into OSPF.
Here is the LSDB and routing table of R2. As you can see we have type 5 external LSAs
and they show up as O E2 entries in the routing table.
R1(config)#router ospf 1
R1(config-router)#summary-address 172.16.0.0 255.255.0.0
This is how you summarize the type 5 external LSAs by using the summary-address
command. This is a different command compared to summarizing the type 3 summary
LSAs.
This is what the LSDB and routing table of R2 looks like after the summarization. That’s
all I wanted to show you about OSPF summarization.
Want to take a look for yourself? Here you will find the final configuration of each device.
329 | P a g e
hostname R1
!
ip cef
!
interface Loopback0
ip address 172.16.0.1 255.255.255.0
!
interface Loopback1
ip address 172.16.1.1 255.255.255.0
!
interface Loopback2
ip address 172.16.2.1 255.255.255.0
!
interface Loopback3
ip address 172.16.3.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
router ospf 1
network 192.168.12.0 0.0.0.255 area 1
!
end
hostname R2
!
ip cef
!
interface Loopback0
ip address 3.3.3.1 255.255.255.0
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
router ospf 1
network 192.168.12.0 0.0.0.255 area 1
!
end
IS-IS Summarization
IS-IS supports summarization but since it is a link-state routing protocol, you can’t do this
within an area as the link-state database have to be the same on all routers within the
area. You can only configure summarization on a “border”. That would be an area border
router or a router that is doing redistribution.
In this lesson, I’ll walk you through both options.
1. Configuration
This is the topology we will use:
330 | P a g e
Above we have R1 and R3 in area 12. R3 is in area 3. On R1 we have two loopback
interfaces. Loopback 0 will be advertised in IS-IS, loopback 1 will be redistributed. I will
show you how to summarize both routes.
Want to take a look for yourself? Here you will find the startup configuration of each
device.
hostname R1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Loopback1
ip address 11.11.11.11 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
ip router isis
!
router isis
net 49.0012.0000.0000.0001.00
is-type level-1
log-adjacency-changes
!
end
hostname R2
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
ip router isis
!
interface GigabitEthernet0/2
ip address 192.168.23.2 255.255.255.0
ip router isis
331 | P a g e
!
router isis
net 49.0012.0000.0000.0002.00
log-adjacency-changes
!
end
hostname R3
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.23.3 255.255.255.0
ip router isis
!
router isis
net 49.0003.0000.0000.0003.00
log-adjacency-changes
!
end
1.1. Summarization
Let’s get started. First, we enable IS-IS on the loopback 0 interface:
R1(config)#interface Loopback 0
R1(config-if)#ip router isis
This loopback has the 1.1.1.1/32 prefix which will show up on R2’s level 1 database:
332 | P a g e
Area Address: 49.0012
NLPID: 0xCC
Hostname: R2
Metric: 10 IS R2.02
IP Address: 192.168.23.2
Metric: 10 IP 192.168.12.0 255.255.255.0
Metric: 10 IP 192.168.23.0 255.255.255.0
Metric: 20 IP 1.1.1.1 255.255.255.255
R2(config)#router isis
R2(config-router)#summary-address 1.0.0.0 255.0.0.0 ?
level-1 Summarize into level-1 area
level-1-2 Summarize into both area and sub-domain
level-2 Summarize into level-2 sub-domain
metric Set metric for summay route
tag Set tag
<cr>
Now let’s take a look how this influences R2’s database. Nothing will change in its level
1 database but the LSP in the level 2 database will change:
333 | P a g e
Above we see that R2 now shows 1.0.0.0 255.0.0.0 in its database. Let’s check its
routing table:
R2 has created a discard route to null 0 for the 1.0.0.0/8 summary. Let’s take a look at
R3 now:
R3 receives R2’s LSP with the summary route so that’s what it will install in its routing
table:
1. Redistribution Summarization
Now let’s see how we can summarize redistributed routes. I will redistribute the second
loopback interface of R1 into IS-IS with a simple route-map:
R1(config)#route-map L1_ONLY
R1(config-route-map)#match interface Loopback 1
R1(config)#router isis
R1(config-router)#redistribute connected route-map L1_ONLY level-1
334 | P a g e
Without summarization, here’s what the level 1 database looks like:
Let’s summarize this redistribute route on R1. You can do this with the same summary-
address command:
R1(config)#router isis
R1(config-router)#summary-address 11.0.0.0 255.0.0.0 level-1
If you summarize into level 1, make sure you add the level-1 parameter or nothing will
happen. Let’s check the routing table of R1:
We can see that R1 has installed a discard route for this summary. Let’s check the level
1 database:
335 | P a g e
IS-IS Level-1 LSP R1.00-00
LSPID LSP Seq Num LSP Checksum LSP Holdtime ATT/P/OL
R1.00-00 0x00000009 0xD76F 1139 0/0/0
Area Address: 49.0012
NLPID: 0xCC
Hostname: R1
Metric: 10 IS R2.01
IP Address: 1.1.1.1
Metric: 10 IP 192.168.12.0 255.255.255.0
Metric: 10 IP 1.1.1.1 255.255.255.255
Metric: 0 IP-External 11.0.0.0 255.0.0.0
Above we can see that the route was summarized directly in the level 1 database. We
can find the summarized route in the routing table of R2:
That’s it.
Want to take a look for yourself? Here you will find the final configuration of each device.
hostname R1
!
ip cef
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
ip router isis
!
interface Loopback1
ip address 11.11.11.11 255.255.255.255
!
interface GigabitEthernet0/1
ip address 192.168.12.1 255.255.255.0
ip router isis
!
router isis
net 49.0012.0000.0000.0001.00
is-type level-1
log-adjacency-changes
summary-address 11.0.0.0 255.0.0.0 level-1
redistribute connected route-map L1_ONLY level-1
!
route-map L1_ONLY permit 10
match interface Loopback1
!
336 | P a g e
end
hostname R2
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.12.2 255.255.255.0
ip router isis
!
interface GigabitEthernet0/2
ip address 192.168.23.2 255.255.255.0
ip router isis
!
router isis
net 49.0012.0000.0000.0002.00
log-adjacency-changes
summary-address 1.0.0.0 255.0.0.0
!
end
hostname R3
!
ip cef
!
interface GigabitEthernet0/1
ip address 192.168.23.3 255.255.255.0
ip router isis
!
router isis
net 49.0003.0000.0000.0003.00
log-adjacency-changes
!
end
2. Conclusion
IS-IS supports summarization but as a link-state routing protocol, there are some
limitations. You can only configure summarization between areas or on a router that is
doing redistribution.
If you configure summarization on an area border router for routes in the level 1
database then it will add the summary route in the level 2 LSP which is advertised to
other areas. If you use redistribution, then the summary route will be added directly in
the level 1 or level 2 LSP
337 | P a g e