In this video we're going to discuss static routes.
I've been asked a number of times about static routes.
Are you able for example to have multiple static routes configured on a router? Are you able to have multiple
default routes configured on a router?
Can you mix default routes and static routes? What's the effect of all of the above?
In this example, we're gonna configure static routes on router 1 and test connectivity to the loopback
of router 5. We have router 2, router 3, and router 4 in the typology and they configured with
different subnets. Router 2 is configured with IP address 10.1.1.2 on the interface, router 3 is configured
with 10.1.2.2 on this interface and router 4 is configured as 10.1.3.2 on this interface or link.
So here's router 1,
What we're gonna test
Is connectivity to the loopback of router 5.
So from router 1, is it able to ping the loopback of router five?
So at the moment when I ping the loopback out of router 5 we get timeouts.
The router is not able to ping the loopback of router 5. Show IP route shows us the routing table.
What you'll notice is that it only contains connected and local routes, there's no route to 5.5.5.5
de-bug IP packet
as an example will show us what happens when the router tries to ping that address. So I'm going to ping
5.5.
and repeat it once and let's see what the output looks like.
Notice unroutable the router doesn't know where to route the packets.
And again that's because there's no route to the destination.
There's also no gateway of last resort set on the router
So it has no way to get to this IP address.
We could configure a route as follows.
So an exact match on the route and point it to 10.1.1.2 which is router 2. Show IP
route now shows us that route in the routing table.
So can this router ping the loopback of router 5?
And the answer is yes it can.
I'm going to disable IP domain look-up here to speed up traceroute.
So let's trace to the loopback of router 5.
Notice it's going via 10.1.1.2 which is router 2 and then it gets to router 5.
What happens if I configure a static route like this and pointed it to router 3? Which way will
the traffic go?
So let's have a look at the routing table.
Show IP route shows us two entries in the routing table.
There are two ways to get to the loopback of router 5.
So if I trace to that loopback notice it's still going via router 2.
In other words it's going to 10.1.1.1
and the reason for that is because this entry is more specific than this entry. Routers when deciding
where to route traffic
look at the longest match of a route. This route is a 32-bit match
this is a 24-bit match.
So the traffic's gonna go via 10.1.1.2
and we can prove that by doing a traceroute if we remove this route from the routing table
and then do a trace again notice the traceroute is going via 10.1.1.2 but that's because we only have
this route in the routing table.
If we created another static route like this
via router 4
which way will the traffic go? So show IP route shows us the two entries we've got a /16
/24.
So when we trace to router 5 notice it's going via router 3 because this is a longer match.
That is a longer match than this.
So router 3 is preferred rather than router 4.
But again if we removed
that route from the routing table so I'm gonna remove this entry.
So remove the static route
now when we look at the routing table we only have this entry so traffic will go via 10.1.3.2.
In other words it's going to go via router 4.
If I add a more specific product of let's say /24
going via router 3 agian
notice the traffic goes via router 3
And if I use a more specific route such as this
going via router 2 rather
notice the traffic goes via router 2. Show IP route shows us those routes /28 route is
more specific than a /24 route which is more specific than a /16 route.
So remember with static routes and this applies to other routing protocols as well more specific matches
win.
So what happens if we add a route like this?
Same mask as router 2 configure it to go to router 3.
So show IP route,
notice the difference in the routing table now we've got two entries for the same route.
So when we trace to the loopback now notice its doing load balancing traffic is load balancing across
both parts and that's because we've got two equal entries in the routing table.
So show run pipe include route
these two routes are going to be used for load balancing because they're the most specific and they're
the same length.
These two will be ignored
but if we copy that and add an entry
going to 10.1.3.2 for router 4 the routing table shows us three entries
now. If we trace to the loopback
now notice its going to load balance across those three routes.
You need to be careful with this because sometimes depending on the router the load balancing may actually
not be true but for CCNA level we assume that it load balances as follows.
So show run pipe include route things to remember more specific entries win if there are multiple
entries with the same route and same mask such as these three the routable load balance across those
paths equally.
So in other words equal-cost load balancing or load sharing. Hope you enjoyed this video if it was of benefit
to you please like it and please subscribe to my YouTube channel.
I wish you all the very best.