Static route configuration | Network Fundamentals Part 18

moving traffic through the network is

something we should all be interested in

routing is arguably one of the most

important considerations for a network

engineer in this and the following two

videos we're going to get an

understanding of how routers forward

traffic and how to configure routing the

whole point of routers is to route or

forward traffic from one network to

another sometimes packets have to be

forwarded across many networks before

they reach their destination

I say routers but these days many

switches are also capable of routing

packets they are called layer 3 switches

or multi-layer switches and as the name

suggests they're good for both routing

and switching layer 3 switches are

especially good for routing traffic

between VLANs while routers are often

used when connecting to the internet or

for LAN connections in these videos I'm

just going to continue using the term

router but be aware that the principles

can apply to layer 3 switches as well

each router in the network will need to

make its own decisions about how a

packet should be forwarded but before

they can do this they need to learn

about paths through the network they

don't just magically know where

everything is

as an example if we open router r5 and

try to ping an IP in a different Network

we can see that it fails to start with

they will know about any network they're

directly connected to these networks

will be added to the routing table which

we can see with show IP route all layer

3 devices will have a routing table

although they may look different

depending on the vendor here we can see

a list of networks with a code on the

left anything with a C code is a

directly connected network if you forget

what a particular code means you can

always look at the handy reference at

the top next to the code is the network

itself the first part is the prefix and

the second part is the subnet mask shown

inside a notation the information

just to the right of that tells us now

router is directly connected to this

network and it tells us which interface

is used the other type of route we can

see here is called a local route which

has an ell code these represent the

routers IP addresses within the

connected network that means that there

is one local route per connected route

can you also see that each local route

has a slash thirty-two mask subnet masks

are 32 bits long

so a slash 32 mask has every bit turned

on so this refers to a single host in

the routing table this is called a host

route as it is pointing to a single host

rather than an entire network connected

and local routes will appear in the

routing table automatically when an

active interface is configured with an

IP address you might also notice that

the routing table has sections that are

listed as either submitted or variably

submitted this goes back to the classful

networking days all this means is that

the submitted network is part of a

larger classful network to be honest I

don't really think about these things

that much as I've said in some other

videos there's not a lot of reason to

think in terms of classes anymore that's

quite a bit to cover in a very short

time so if you want test whether this is

making sense by trying out these

questions if we want a router to reach

other networks that is networks that

aren't connected we can configure a

static route to point the way he is the

anatomy of a static route it includes

the destination network that we want to

reach this may be a nearby network or it

could be some distance away the subnet

mask of the remote network the next hop

IP that we forward packets to the next

hop IP in most cases will be the IP

address of another router in a network

that our router is directly connected to

for example router r5 may use the IP

address of r3 as a next hop as they both

have interfaces in the 170 to 1600

Network maybe it's easier to see this in


let's configure r5 with a route so we

can reach the one or two one six eight

3.0 Network we use the IP route command

add in one or two one six eight 3.0 give

it the subnet mask of 1603

we're not limited to just one static

route of course we can create many more

for example a route to 172 1636 zero now

let's take a look at that routing table


see how there are now two new routes

listed they have an S code which refers

to a static route a static route is one

that we can forget manually the entry

for a static route looks different to

the connected and local routes next to

the network and mask we have the numbers

1 / 0 in square brackets and I'll

explain that one a little bit later

further to the right we have the IP

address of the next hop this is the IP

that the router will forward packets to

if it needs to send them to this network

I have a few good labs at the end of

this video too that you can try this on

if you want to what do you think will

happen to a static route if a link fails

we're going to simulate this in the

background by breaking our 5s interface

to switch 1 if a router no longer has an

interface in a network that contains the

next hop then the static route will be

removed from the routing table if we

want we could bypass this behavior

enforce the route to stay in the routing

table no matter what

by adding the permanent keyword to the

end of the IP route command this won't

magically make the route work though it

will only force the route to stay in the

routing table if we now fix that

interface the route appears back in the

routing table once again let's take a

look at something that you might not

have thought of

first let's ping one onto 1 6 8 3.3 and

that works just as we would expect

that's using one of the routes we

configured a few moments ago when we

send a ping the router select an IP e

that it thinks is suitable as the source

of this packet so the ping will be sent

from 170 to 1605 when r3 needs to

respond it will send the response

message back to 172 1605 we can change

this behavior by adding the source key

word this changes the source IP that our

router users when sending the ping

message and this fails do you know why

do you remember earlier that I said that

each router needs to make its own

routing decisions when r3 gets the ping

it will need to look at its routing

table to decide how to send a response

back to

one seven two sixteen 205 however right

now our three does not have a route back

to 170 216 205 the key takeaway here is

that when we think about routing we need

to think about how to get traffic to its

destination as well as how the

destination router can send traffic back

so how do we fix this we can add a new

route to r3 this route goes to the 172

16 200 zero network using R 5 as the

next hop

if we go back to our fire

and try that ping again we can see that

it is now working let's consider another

scenario we've seen that a static route

will be removed from the routing table

if a critical interface fails what

happens if something else along the path

breaks but the interface stays up let's

simulate this by shutting down an

interface on our three

as you would expect the static route on

r3 is removed from our three Z routing

table what do you think will happen on

r5 r5 is not physically connected to r3

it's connected to a switch so while our

threes interface is shut down

r5 will stay up as our 5s interface is

still up the static route will remain in

the routing table they won't be able to

reach our three though so traffic using

this route will flow into a black hole

this is a key limitation of static

routes by default they are not very

aware of the state of the network while

we're still talking about static routes

there is an alternative way that we can

use them if we want we can configure an

outgoing interface rather than a next

hop IP in cases like this the router

will use an ARP message to find the IP

address of the next hop this might be

used in a case where we have a small

network with only two routers in it for

example like the small network between

r1 and r2 personally I don't really like

using these types of static routes very

often I much prefer using a next hop IP

address but you need to be aware that

sometimes you will see them out there

I've already mentioned a few times that

each router will make its own decisions

about how to handle and forward packets

let's take a little time to think about

how we'll make these decisions and how

packets flow through the network to

start with a host connected to the

network will create a packet if this

needs to go to any network that is not a

part of it we'll send the packet to its

default gateway once the packet arrives

at the router the router needs to decide

what to do technically at this point it

is a frame not a packet as it will still

have a layer 2 header probably Ethernet

so the first router will check to see if

the frame is valid or corrupt if it is

corrupt it will be discarded if it's


it will D capsulate the frame leaving a

packet it can now retrieve the

destination IP address in the IP header

and compare it to routes in the routing

table if there is a route the router

will prepare to

or the packet to the next hop this

includes getting the MAC address of the

next hop and encapsulating the packet

with new Ethernet headers and trailers

if there is no suitable route in the

routing table the router will drop the

packet keep in mind though that the

router will not check if the next hop is

up if the next hop does not exist the

packet will be dropped and if you want

to test yourself out here are a few more

quiz questions you can try so hosts have

a default gateway guess what

routers do too if a router does not have

a route to a particular destination it

can use its default route it's kind of a

catch-all route that's used if nothing

better can be found the best example of

when this is used is for your internet

connection in most networks you can't

reasonably be expected to have a route

for every possible destination on the


so for this you will have a default

route we can still configure this like

any other route though the difference is

that the destination network is

with a subnet mask of

this will match everything assuming that

there's nothing more specific of course

when we look at the routing table we see

this in two places for one it will show

up as a regular route the only

difference is the star symbol the star

symbol means candidate default you can

have more than one default route

configured if you want to but the router

will only use one at a time so the

candidate default is the one that the

router is using right now we also see

this listed as the Gateway of last

resort this is also the default route

that is currently in use either default

route only for internet access no we can

use this in other cases to look at our

six in this topology there is only one

way in and one way out and that is the

path through r3 when configuring routing

on r6 we could create separate routes

for all the networks in our topology but

that will take a fair bit of effort so

instead why not just configure r6 with a

default route

using our three is the next hop it

catches all traffic anyway which we can

see with the ping this is a type of

summary route we're making life easier

by combining several routes into one

simplified route the best way to lock

all this in your brain is to practice so

I have two challenges for you firstly

start by building this topology for the

networks around the edges I recommend

using loopback interfaces our members

have it easier as you can download the

starting topology from the website next

configure static routing on all routers

so every router can reach every other

network you can test it out with a ping

remembering to change your source IP on

occasion if you are willing to download

labs from the site I have an additional

challenge for you I have configured the

topology but it's broken you need to use

the skills that you've learned in this

video to try to repair the network so

all the routers can reach all the other

networks once again this lab is the one

that will probably give you the most

benefit if you can try to practice the

skills you've learned here there really

is no substitute for practice also

consider going back to videos 12 and 13

where we talked about VLANs and router

on a stick see if you can figure out how

the router on a stick configuration

works and how packets are forwarded

between VLANs in the next video we begin

discussing dynamic routing so I hope to

see you there