IP Addressing and Routing Part 3: Default and Static Routing
For those of you who missed Parts 1 and 2 of my IP Addressing and Routing mini-series you can see the articles here:
I suggest taking a look at the first two parts before moving on to the third one, just because there is a lot of fundamental concepts and information that you will need to get a clear understanding of what I will be talking about in this part.
For those of you who have been able to keep up with the first two parts, let’s get started. As promised, today we are going to talk about different types of routing:
- Static routing
- Default routing
- Dynamic routing – to be discussed in detail in a later post
I’ll start with an explanation of how you can setup static and default routing on your Cisco routers. I will also illustrate how you can use Administrative Distances in your static routes. Dynamic routing, as mentioned above, is a more advanced topic that requires a separate post — I don’t want to overload you with too much information right now.
For those of you who did have the chance to go through my previous posts you will know by now that routers in order to be able to route packets to their final destination, need to maintain a routing table in which all the necessary information will be held. The information needed is simply a combination of networks and output interfaces on the router that can reach those networks.
Each time a router receives a packet it inspects the destination IP address and tries to find, by looking in its routing table, a possible route to that IP address. Routers do not send broadcasts looking for the remote networks; therefore if a network is not listed in a routers table, the router simply discards the packets.
Now how does a router maintain its routing table? The answer is pretty straightforward. Either manual route directions are configured on the router or dynamic protocols are used to populate routing information to routers.
Manually configuring routes on your router can be both beneficial and disadvantageous. Static routing has the following benefits:
- No extra processing and added resources as in the case of dynamic routing protocols
- No extra bandwidth requirement caused by the transmission of excessive packets for the routing table update process
- Extra security by manually admitting or rejecting routing to certain networks
Disadvantages of static routing include the following:
- Network Administrators need to know the complete network topology very well in order to configure routes correctly
- Topology changes need manual adjustment to all routers something which is very time consuming
Getting Familiar with Static Routing
To manually insert a static route into the Cisco routers routing table the following command syntax needs to be followed in global configuration mode:
Let’s take a look at each part of the static route command:
- IP route: Is the standard announcement of the static route command
- Destination network address: Is the IP address of the network to include in the routing table
- Subnet mask: Is the mask of that network
- Next-hop address: Is the address of the next-hop router that will receive packets from you and forward them to the destined network
- Output interface: Instead of next hop address you can declare the exit interface on your router
- Administrative distance: Is used to apply a sort of prioritization (weigh factors) on static routes, so that different routes to a given destination would follow a certain activation pattern. The Administrative distance (AD) is just an integer from 0 to 255 where 0 indicates a first priority route and 255 means that no traffic is allowed to pass through this route. By default the AD of directly connected interfaces is 0 and for static routes it’s 1
- Permanent: With the permanent word, the router is forced to keep this route in its routing table even if the interface leading to this network is shutdown. Under normal circumstances, if this happens, static routes involved are automatically removed from the routing table
When to Use Default Routing
Default routing is used only in stub networks. Stub are the networks that have only one output interface and everything going through these networks has to cross the single exit point.
Instead of having many static routes pointing to remote networks via the single output interface, a single default route is configured that matches all possible routes.
Using Administrative Distances in Static Routes
By default, Static routes have an administrative distance (AD) of 1. ADs are used for prioritization purposes. Different routes, in a specific destination network can be assigned different weights so that one of the routes is used in favor of the other. Routes having the same weight load share the traffic. We will see in practice further on how we can change ADs in static routes.
Putting Routing into Practice
Let’s use an example to illustrate the configuration process for static and/or default routes.
RouterA is directly connected to networks 22.214.171.124/30, 126.96.36.199/30 and 192.168.10.0/24. In order for RouterA to be able to route packets to all other networks the following static routes need to be configured on the router:
- RouterA(config)#ip route 192.168.20.0 255.255.255.0 188.8.131.52
- RouterA(config)#ip route 184.108.40.206 255.255.255.252 220.127.116.11
- RouterA(config)#ip route 192.168.30.0 255.255.255.0 18.104.22.168
The configuration provided above is only one possible solution. A second solution could be defining a default route pointing to network 22.214.171.124/30 since RouterA is a stub router. Once this is configured, everything will be routed to that specific network. The command to configure this default route is:
- RouterA(config)#ip route 0.0.0.0.0 0.0.0.0 126.96.36.199
You may have already noticed that we have two links connecting RouterA and RouterB together. If we wanted to share traffic between these two links then we could use the following set of commands:
- RouterA(config)#ip route 0.0.0.0.0 0.0.0.0 188.8.131.52
- RouterA(config)#ip route 0.0.0.0.0 0.0.0.0 184.108.40.206
Using the commands above, all traffic from RouterA is load shared between these two links (this is a load share per destination and not a 50-50 load sharing).
In case we wanted one of the links as a backup, so that it will be activated only when the primary link goes down, then we could assign different Administrative Distances to the links like, the following:
- RouterA(config)#ip route 0.0.0.0.0 0.0.0.0 220.127.116.11 1
- RouterA(config)#ip route 0.0.0.0.0 0.0.0.0 18.104.22.168 100
The route with the lower AD (in our case AD=1) would be the primary route and the other would be the backup route (in our case AD=100).
Guess What? The Rest is Up To You!
So far, I’ve shown you how static routes/default routes/priority routes can be defined on RouterA. Still, RouterB and RouterC cannot fully route all subnets to each other and to RouterA. Similar configuration needs to be performed on the other routers as well. But I will leave that for you to carry out.
Remember that routers only know about networks directly connected to them. Static routes or routes learned by dynamic protocols have to be configured in order for the routers to do their job: Routing packets of course. Also keep in mind that default routes are chosen when there is no specific match in the routing table to a given network. They are preferably used in stub networks.
So go ahead and give this a try! Start by configuring either Static routes, or Default routes. You could even load share traffic when appropriate. And as always, feel free to leave me a comment if you run into any difficulties, or if you have any questions.