So here's our game plan.
Let's go ahead and configure some specific static routes
starting on R1.
So on R1, let's train R1 that to get to the 10.4.0 network,
it should use R2 as its next hop.
Let's also configure R1 that if it needs to forward packets
to the 10.5.0 network, it should also use R2 as its next stop.
R2 needs to also be able to forward packets.
So in R2, we could create some specific routes as well--
on how to reach 10.1.0 or we could go ahead
and use a static default route, which basically says dear
Mr. R2, if you get a packet for a network
and you don't know how to reach that network,
go ahead and use your default route.
So let's begin by taking a look at the routing tables
on these routers before we add any new configs.
And to do that, on a Cisco router, we can use the command
show ip route.
And I'm going to send that command to both the router
1 and router 2, and then we can go ahead
and look at the results.
So here on router 1--
router 1 is directly connected to the 10.1.0
network and the 10.2.0 network and the 10.3.0 network.
And this last 24, immediately following,
represents that these first three numbers, of 10.1.0,
represents the actual network.
We'll cover more about that detail
in separate IPv4 Nuggets.
So R1 is directly connected to those three networks.
Fantastic.
Let's take a look at router 2.
So here on router 2--
router 2 is directly connected to 10.3 network, the 10.4
network, and the 10.5 network.
So let's start our configuration back on R1
starting from the left going to the right.
And on the Cisco router, we'll go into configuration mode
by typing in configure space terminal or for short configt.
And then, we'll have the command-- ip route
10.4.0, space, then 255 repeated three times
followed by a zero, space, then 10.3.0.2.
Now let's decode what that is.
What we're saying to the router is
we're adding an IPv4 route to reach the 10.4.0 network.
And these first three groupings that say 255.
255.
255, that's very much like this option here-- slash 24.
It means to the router that we're
focusing on the first three numbers
in this IP address that are representing
the network that we are creating the static route for.
And this instruction further says,
that if you need to ever forward a packet to 10.4.0.
anything, the next hop you can use
is your good buddy, R2 at the IP address of 10.3.0.2.
So that one static route teaches the router
how to reach the 10.4.0 network.
But we have one more-- it's the 10.5.0 that R1 also
needs to be able to reach.
So we need to go ahead and hit the upper row key.
And we'll go back and change out the 10.4.0 to a 10.5.0
and press Enter.
And now we've just entered two static routes.
So now, if we issue the command, show ip route,
we have two new static routes right here--
that basically say to get to 10.4.0 or 10.5.0,
I'm going to go ahead and use the next hop of 10.3.0.2,
which is R2.
Next, let's go ahead and configure a static route on R2,
so that it knows how to forward packets in the direction
of the 10.1 or 10.2 networks if it needs to.
So we'll go back to router 2.
And here on router 2, we'll go back into configuration mode.
And let's do an example of a default route.
It goes something like this-- ip route 0000.
That represents a default route, and we're
going to follow it by another set of quad zeros like this.
And then, we're going to specify the next hop for this default
route.
And that next hop is going to be Mr. R1 in our topology, which
is 10.3.0.1.
We'll press Enter.
We'll end to get out of configuration mode.
And let's do a show ip route once again.
So here's the logic.
If an IP router receives an IP packet,
the router looks at the layer 3 information,
looks at the destination, and then
looks at its routing table.
So if R2 received a packet that had a destination IP
address of 10.1.0.55, router 2 is
looking at its routing table.
That's not it.
None of those are it.
It's going to use the default route.
And because we have that static route there,
that's also why we have this message right here--
the Gateway of last resort, when you don't know what else to do,
go ahead and forward the packet to the next hop that owns
the IP address of 10.3.0.1.
And now it's his problem or her problem.
So next, let's go ahead and test this
by doing a ping from PC1, who's at 10.1.0.11 and let's
ping it out 10.5.0.55, which is a PC down on the 10.5.0
network, and we'll press Enter.
And because R1 and R2 both know how
to route based on the static routes that we added,
we have full connectivity between a PC on the 10.1.0
network and a PC on the 10.5.0 network.
I hope this has been informative for you,
and I'd like to thank you for viewing.