This lesson is all about IP routing. We will compare and contrast static versus dynamic routing and highlight the benefits and drawbacks of each option. You will then get a chance to configure and monitor static routes on IOS routers by using the command-line interface, including special cases like default routes.
At this point, we know what the routing function is all about. Routers will maintain intelligence of the network topology and forward packets based on destinations, selecting the best path across that topology. That intelligence of the topology and changes in the topology are maintained statically or dynamically.
Dynamic information includes connected networks, which the router knows and is able to insert in the routing table. This is dynamic because if the directly connected interface goes down, then router will adjust and remove that destination from the routing table. Dynamic information also includes destinations learned via routing protocols. In some scenarios like stub networks or locations with a single link into the network or even Internet connectivity, static routing is also an option.
Identifying Static and Dynamic Routes
Static routes do not add overhead in the form of routing protocols, advertisements, and extra intelligence on the routers. They are fairly simple to configure and if you remain within a certain limit in terms of the number of static routes, then they are very flexible. However, they are static and so the router will not adjust to network changes, if you use static routing.
With dynamic routing protocols, then you have the overhead of advertising and learning networks, but you will adjust the network changes. How fast you adjust and how fast you converge to learning or selecting a different path, that depends on the routing protocol.
It is on those scenarios of stub networks like the one in the figure with a single link into the rest of the network, that static routing is a suitable answer.
For upstream traffic, leaving the stub network, a special case of static route, the default route is typically used to forward all traffic to all destinations outside of the stub network. The Internet is a perfect example of this. You do not really want to know the specifics of which destinations you want to reach. You know that all of them are outside and all of them are simply reachable through that one link.
So the default entry that says any unknown destination, send it this way through router A, in this example, is going to be enough. Every time we configure static routing, we should think about the bidirectional nature of traffic, and so as we send traffic outbound, we will receive return traffic coming in. If that is the case, then we would also need to configure static routing on router A in this case, pointing to the networks on the stub. In some instances, you could even see hybrids of static and dynamic routing. For outbound traffic, you would configure a default route at router B and for inbound traffic, you could configure B to advertise those routes with the dynamic routing protocol and then traffic coming inbound would be known to A and be forwarded by A.
Static Route Configuration
In order to configure static routing in Cisco IOS routers, this is the command to use.
Router(config)#ip route [network/host] [mask] [address/interface] [distance] [permanent]
The IP route command includes the destination network followed by a mask and so you can insert CIDRE or Classless Inter-Domain Routing Entries pointing to subnets with multiple mask sizes. The ultimate entry would be a /32, a host entry in the routing table, where the destination is an actual host and not a network. The next component is the next-hop and this could take the form of an IP address that of the next router in the path or a local interface, which would be the interface to use to get to the destination network.
It is recommended that you use point-to-point interfaces when using this option. It will not work if the interface is a multi-access interface like Ethernet. Default administrative distance for static routes is one, and you can change this parameter to create floating static routes for backup connectivity. Remember, the administrative distance is the priority of the protocol. With an admin distance of 1, static routes will step on and overwrite most dynamic routing protocols. In other words, if the same destination is learned via routing protocol and you insert a static route to it, then the static route will win because it has the lower administrative distance.
Static Route Example
Here is an example of a static route configured at router A there.
RouterX(config)# ip route 172.16.1.0 255.255.255.0 172.16.2.1
RouterX(config)# ip route 172.16.1.0 255.255.255.0 s0/0/0
It points to the stub network and there are two options here, one to point to router B’s IP address on the serial interface or simply specify the local serial interface of router A. The interface option is typically used in floating static routes and backups and the IP address is typically used in a single point-to-point link scenario. Remember, this is only a unidirectional route; if you want traffic to leave the stub network, you would have to define static routing or dynamic routing also at router B.
And here is how to do that. This time the static route at router B points to all unknown destinations. This is designated by all zeros in the destination and mask.
RouterX(config)# ip route 0.0.0.0 0.0.0.0 172.16.2.2
Notice the three indicators of default routes: the first one is the all zeros destination, this signals the default route; secondly, the asterisk (*) is a candidate default and there could be more than one in a certain router; and finally, the indication up there that says gateway of last resort is 0.0.0.0. The entry is not only a default but a static default as designated by the S in the first column.
Router#sh ip route
Codes: C – connected, S – static, R – RIP, M – mobile, B – BGP
D – EIGRP, EX – EIGRP external, O – OSPF, IA – OSPF inter area
N1 – OSPF NSSA external type 1, N2 – OSPF NSSA external type 2
E1 – OSPF external type 1, E2 – OSPF external type 2
i – IS-IS, su – IS-IS summary, L1 – IS-IS level-1, L2 – IS-IS level-2
ia – IS-IS inter area, * – candidate default, U – per-user static route
o – ODR, P – periodic downloaded static route
Gateway of last resort is 192.168.1.1 to network 0.0.0.0
C 192.168.62.0/24 is directly connected, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/1
S* 0.0.0.0/0 [1/0] via 192.168.1.1
Our Recommended Premium CCNA Training Resources
These are the best CCNA training resources online:
Click Here to get the Cisco CCNA Gold Bootcamp, the most comprehensive and highest rated CCNA course online with a 4.8 star rating from over 30,000 public reviews. I recommend this as your primary study source to learn all the topics on the exam.
Want to take your practice tests to the next level? AlphaPreps purpose-built Cisco test engine has the largest question bank, adaptive questions, and advanced reporting which tells you exactly when you are ready to pass the real exam. Click here for your free trial.