In this lesson, we're going to discuss loops,
specifically switching loops and routing loops.
First, we have switching loops.
Switching loops or bridging loops are going to occur
whenever there's more than one path
between a source and destination device.
As broadcast packets are sent
for switching through every single switch port
flooding can really occur quickly
when broadcast messages are sent
and then repeated back through another switchboard
in this looped architecture.
This will create a broadcast storm for you.
Since our modern networks are built
with additional load balancing and fault tolerance,
there's usually going to be multiple physical connections
between each part of the network.
And so naturally, we would have loops
and switching loops would become inevitable
if we didn't put some protections in place to prevent them.
So how are you going to prevent them?
Well, to prevent a switching loop, you have to enable STP,
the Spanning Tree Protocol.
Check if STP is enabled and configured on your switch.
You need to use the command show spanning tree
and then hit enter.
For the network+ exam, you do not need to know
how to configure a Spanning Tree Protocol on a switch,
but I'm showing you what it looks like
just for demonstration purposes here.
Now you can see here the information for this switch
in VLAN 0001, which is our default VLAN.
In this example, the Root ID is set
with a priority of 1 and a cost of 2.
The Bridge ID is set with a priority of 61,441.
As we look at the different interfaces on the switch,
you can see there are two ports
that are designated as the root port
that will forward traffic
and all the other ports are set as designated ports.
Eth1/11, 1/12, 1/15 and 1/16 are all in a blocking state.
And this is what prevents a loop
from occurring with this switch.
Now, the bottom line here when it comes to switching loops
is that if you suspect a switching loop
it's likely an issue with how you configure your STP,
and you need to escalate this work
to a network administrator or network engineer
to troubleshoot it, reconfigure it, and repair it.
Next, let's talk about routing loops.
A routing loop is formed when an error occurs
in the operation of your routing algorithm,
and this creates a circular route
amongst a group of network devices.
Routing loops are caused by incorrect configurations
of your routing protocols where data packets get sent
between different hosts of different networks,
and they get caught in this endless loop
traveling in a circle between the different network routers
with incorrect route entries.
Remember, we want multiple physical connections
between our routers because this gives us higher redundancy
and fault tolerance.
So our routing protocols have methods in place
to protect us from physical loops causing issues,
things like weighted connections
based on hops with the speed of those connections.
For example, distance vector routing protocols
use a Time To Live or TTL in the data gram header
of the IP packets,
and this will help us avoid routing loops.
So if a packet reaches the Time To Live of 0,
it's going to be dropped by the router
and it's not going to be forwarded.
And that effectively ends your routing loop.
Routing loops, unlike switching loops
are not caused by physical circular connections,
but instead by the logical layer three circular connections
that can exist within your routing tables.
Now another method to prevent routing loops
is known as split-horizon.
If you configure split-horizon,
you're going to ensure that you have this router configuration
that stops a route from being advertised
back in the direction that it came from.
This split-horizon mechanism ensures
that a router cannot send back alert route
to the same router that it learned it from.
To set up split-horizon on a Cisco router, for example,
you're simply going to enter the command ip split-horizon
and hit enter at the command line interface.
If you believe split-horizon has been disabled by accident,
you can look to see if the no ip split-horizon command
was previously issued.
Now, route poisoning is another method we can use
to avoid routing loops inside of our networks.
If a router detects
that one of its connected routes has failed,
the router's going to poison that route
by increasing its metric to an infinitely high number.
This happens automatically inside your routers.
So that really isn't something you have to do
or configure, it'll just happen for you.
Finally, we have hold-down timers.
Hold-down timers are used to prevent bad routes
from being restored and passed to other routers by accident.
Now, hold down-timers are used
with distant vector routing protocols like RIP.
The router's going to be configured, so it will not advertise
or accept any routes that are in a hold-down state.
This occurs for a set period known as the hold-down period.
By default, the hold-down timer is set at 180 seconds
or three minutes when you're using RIP
as your routing protocol,
and it should be configured that way
automatically by your router.
As I said, most of the routing loop issues can be solved
by simply using the right routing protocols,
ensuring they're configured properly.
If you're adding a bunch of static routes into your router,
be really careful
because this is how most routing loops are going to be created.
Remember, statically created routes
are given a metric of 1 by default,
making it extremely highly trusted by the router.
The only type of route that the router will trust
more than your statically assigned route
is a directly connected route.
Any routes that it learns through OSPF
or RIP or BGP or EIGRP,
any other routing protocol will not overwrite
that static route that you created.
So you have to be careful with static routes
in order to prevent a potential routing loop.