Router tables can be manually configured using static routes. In this video, you’ll learn about routing tables, static routes, and how to define a static route in a router.
The routers that we use in our homes and our offices have an important job of forwarding traffic between one IP subnet and another. It’s a relatively straightforward process, although there is a lot of technology under the surface that makes this happen. But if we were to look at this in a very simplified form, we could see that the router is performing a series of relatively simple steps.
The first step is to identify what the destination IP address might be for incoming traffic into the router. It looks into the packet, identifies what the destination IP address is, and makes a note of where it should be sending this traffic. The router then examines some tables to determine what the best route will be for this particular packet. If the destination IP address of this particular packet is associated with a subnet that is directly connected to this router, then the router simply sends the packet onto that local subnet.
But in many cases, the destination IP address is on a subnet that is not locally connected to this router. The router will examine that routing table, determine what the best next hop might be, and then send the traffic out that particular interface. This next hop is the IP address of the next router down the line. And when that router receives this packet, it performs the same process again, until the packet finally makes its way to its final destination. As you can imagine, that routing table becomes very important. And when we’re troubleshooting routers, we refer often to the routing table, what the next hop might be, and determining where these packets should be going once they leave our router.
If a router refers to its table and does not find a next hop for that destination IP address, it will simply discard that traffic. So you can see why having a valid routing table becomes very important. Let’s look at this network diagram. There are three separate routers in this network diagram and three individuals that would like to communicate with each other.
In this case, let’s focus on router 1. You can see router 1 is connected to three different subnets. We have a subnet 10.10.10.0/24. There’s another subnet between router 1 and router 2– that is the 10.10.40 network– and then another subnet between router 1 and router 3. That’s the 10.10.50 subnet. Those three subnets are directly connected to router 1.
So if we were to look at the routing table for router 1, it would see the route for 10.10.10.0/24, 10.10.40.0/24, and 10.10.50.0/24. And all of those networks are locally connected to this router. The problem occurs if Sam would like to communicate to Jack. Although router 1 knows about the local networks, it has no idea that there are more networks on the other side of router 2 and of router 3. And those particular networks of 10.10.20.0/24 and 10.10.30.0/24 are nowhere in this routing table.
This means if Sam wants to send traffic to Jack, Sam will put this packet out on the network. It gets to router 1. Router 1 examines the destination IP address of 10.10.20.2 and then looks through its table and realizes there is no 10.10.20 network in the routing table. And the packet is discarded and never makes its way down the network.
One way that we could create a more complete routing table is to build it ourselves. This administrative creation of a routing table is referred to as static routing. And if you would like to build static routes as the administrator of your routers, then you will manually be configuring these routes inside of every router that you use.
Static routing is a very quick way to configure a route inside of the router. And if you’re managing a smaller network, this might be a perfectly reasonable way to manage where the routes might be. Because we’re static routing, there’s no overhead that you would normally see from a dynamic routing protocol. We’ll talk about dynamic routing in a future video. So there’s no CPU cycles. There’s no memory usage. We are simply adding the route ourselves. And we don’t have to do any additional processing to the routing table from there.
This is very common for remote locations, where you might have a single internet connection into that remote site, and all communication takes place over that single connection. We often refer to these as stub networks. And because we don’t have to worry about any type of dynamic routing updates or having any changes to the router configuration because of those updates, this is a relatively secure form of routing.
However, this can be challenging to configure on larger networks. Configuring a handful of routers with their own static routes is relatively straightforward. But if you’re managing hundreds or thousands of routers, manually configuring a static route in each of those routers could take quite a bit of time. This also relies on you adding the correct routes to every router. There have been times when I’ve configured static routes, and I’ve set up my own routing loop within my network because of a misconfiguration.
And as the name implies, these routes are static. They don’t change once you’ve configured them. So if there are changes to your network, you’ll need to manually log into your routers and make those configuration updates to the routing table that match the changes to your network. This also means that there is no automatic rerouting if something happens on your network. You will need to manually configure these routes if anything needs to be routed in a different direction.
So let’s configure some static routes for router 1. We know that we have our three locally connected routes. But we also have these additional two routes, one that’s behind router 2 and one that’s behind router 3. This would be the 10.10.20 network and the 10.10.30 network.
So we might SSH into router 1. And at the command line, we would begin to add additional static routes. For example, we might tell router 1 that if it receives any packet coming through with a destination IP address that matches the range of 10.10.20.0/24, then send that particular packet to 10.10.40.2. So if the packet does come through with that destination that needs to go to the local network that Jack is connected to, it will send all of that traffic to the IP address 10.10.40.2, which is located on router 2.
At that point, router 2 will examine its own routing table and know that the 10.10.20 network is locally connected and send that packet on its way. We can do the same thing with the 10.10.30.0 network. So we will manually configure a static route that if any destination traffic is going to 10.10.30.0/24, then send all of that traffic to 10.10.50.2, which means all of that traffic will go to router 3.
Now that we’ve configured those static routes in router 1, any time those additional networks are seen as a destination IP address, router 1 will know exactly where to send that traffic.