-: Loops, in this lesson, we're going to discuss loops, 2 2
specifically switching loops and routing loops. 3 3
First we have switching loops. 4 4
Switching loops, or bridging loops, 5 5
are going to occur whenever there's more than one path 6 6
between a source and destination device. 7 7
As broadcast packets are set for switching 8 8
through every single switch port, 9 9
flooding can really occur quickly 10 10
when broadcast messages are sent 11 11
and then repeated back through another switch port 12 12
in this looped architecture. 13 13
This will create a broadcast storm for you. 14 14
Since our modern networks are built 15 15
with additional load balancing and fault tolerance, 16 16
there's usually going to be multiple physical connections 17 17
between each part of the network. 18 18
And so naturally, we would have loops 19 19
and switching loops would become inevitable 20 20
if we didn't put some protections in place to prevent them. 21 21
So, how are you going to prevent them? 22 22
Well, to prevent a switching loop, 23 23
you have to enable STP, the spanning tree protocol. 24 24
To check if STP is enabled and configured on your switch, 25 25
you need to use the command, show span tree, 26 26
and then hit enter. 27 27
For the network plus exam, you do not need to know 28 28
how to configure a spanning tree protocol on a switch, 29 29
but I'm showing you what it looks like 30 30
just for demonstration purposes here. 31 31
Now you can see here, the information for this switch 32 32
in VLAN0001, which is our default VLAN. 33 33
In this example, the route ID 34 34
is set with a priority of one at a cost of two. 35 35
The bridge ID is set with a priority of 61,441. 36 36
As we look at the different interfaces on this switch, 37 37
you can see there are two ports 38 38
that are designated as the root port 39 39
that will forward traffic. 40 40
And all the other ports are set as designated ports. 41 41
Eth1/11, 1/12, 1/15, and 1/16 are all in a blocking state. 42 42
And this is what prevents a loop from occurring 43 43
with this switch. 44 44
Now the bottom line here, when it comes to switching loops, 45 45
is that if you suspect a switching loop, 46 46
it's likely an issue with how you configure your STP 47 47
and you need to escalate this work 48 48
to a network administrator or network engineer 49 49
to troubleshoot it, reconfigure it and repair it. 50 50
Next, let's talk about routing loops. 51 51
A routing loop is formed when an error occurs 52 52
in the operation of your routing algorithm. 53 53
And this creates a circular route 54 54
amongst a group of network devices. 55 55
Routing loops are caused by incorrect configurations 56 56
of your routing protocols, 57 57
where data packets get sent 58 58
between different hosts of different networks. 59 59
And they get caught in this endless loop, 60 60
traveling in a circle between the different network routers 61 61
with incorrect route entries. 62 62
Routing loops, unlike switching loops 63 63
are not caused by physical circular connections, 64 64
but instead by the logical layer 3 circular connections 65 65
that can exist within your routing tables. 66 66
Remember, we want multiple physical connections 67 67
between our routers, 68 68
because this gives us higher redundancy and fault tolerance. 69 69
So our routing protocols have methods in place to protect us 70 70
from physical loops causing issues. 71 71
Things like weighted connections based on hops 72 72
or the speed of those connections. 73 73
For example, distance vector routing protocols, 74 74
use a Time to Live, or TTL, in the data gram header 75 75
of the IP packets. 76 76
And this will help us avoid routing loops. 77 77
So, if a packet reaches the Time to Live of zero, 78 78
it's going to be dropped by the router 79 79
and it's not going to be forwarded. 80 80
And that effectively ends your routing loop. 81 81
Now, another method to prevent routing loops 82 82
is known as split-horizon. 83 83
If you can figure split-horizon, you're going to ensure 84 84
that you have this router configuration 85 85
that stops a route from being advertised back 86 86
in the direction that it came from. 87 87
This split-horizon mechanism ensures that a router 88 88
can not send back alert route to the same router 89 89
that it learned it from. 90 90
To setup split-horizon on a Cisco router, for example, 91 91
you're simply going to enter the command ip split-horizon 92 92
and hit enter at the command line interface. 93 93
If you believe split-horizon has been disabled by accident, 94 94
you can look to see if the no ip split-horizon command 95 95
was previously issued. 96 96
Now, route poisoning is another method we can use 97 97
to avoid routing loops inside of our networks. 98 98
If a router detects that one of its connected routes 99 99
has failed, the router is going to poison 100 100
that route by increasing its metric 101 101
to an infinitely high number. 102 102
This happens automatically inside your routers. 103 103
So there really isn't something you have to do or configure, 104 104
it'll just happen for you. 105 105
Finally, we have hold-down timers. 106 106
Hold-down timers are used to prevent bad routes 107 107
from being restored and passed 108 108
to other routers by accident. 109 109
Now hold-down timers are used 110 110
with distant vector routing protocols like RIP. 111 111
The router is going to be configured, 112 112
so that will not advertise or accept any routes 113 113
that are in a hold-down state. 114 114
This occurs for a set period known as the hold-down period. 115 115
By default, the hold-down timer is set at 180 seconds 116 116
or three minutes when you're using RIP 117 117
as your routing protocol. 118 118
It should be configured that way, 119 119
automatically, by your router. 120 120
As I said, most of the routing loop issues 121 121
can be solved by simply using the right routing protocols, 122 122
ensuring they're configured properly. 123 123
If you're adding a bunch of static routes into your router, 124 124
be really careful because this is how most routing loops 125 125
are going to be created. 126 126
Remember, statically-created routes are given a metric 127 127
of 1 by default, making it extremely, highly trusted 128 128
by the router. 129 129
The only type of route that the router will trust more 130 130
than your statically assigned route 131 131
is a directly connected route. 132 132
Any routes that it learns through OSPF or RIP or BGP 133 133
or EIGRP or any other routing protocol 134 134
will not overwrite that static route that you created. 135 135
So you have to be careful with static routes 136 136
in order to prevent a potential routing loop.