Routing is at the core of the network infrastructure. Routing is what ultimately lets you get from point A to point B not only in your own network, but also across the entirety of the world wide web. Routing in its simplest form tells your network devices the path to get to another network device located on another network. This was originally handled by creating static routes to the required destinations.
While this process of created static routes worked fine in the initial states of networks, the size and growth of connected devices has fast surpassed that of manageable static routes. This is because for every static route to a destination, and reverse route back has to be created. This is true on every router in between. An example of the complexity in created static routes, even in a small four router network, is displayed below as means to teach you how to create static routes. While dynamic routing protocols have been developed to alleviate this management problem, a static route still holds value.
Static routes can be utilized to create a default route for all traffic with a destination unknown to the routers routing table. Along this same concept, a static route can be used with object tracking to provide a failover default route to provide redundancy and increase uptime. Another common instance of utilizing a default route is when connecting to a partnered company through a single link where dynamic routing protocols are undesirable either from a security standpoint, or the scope of needs. All of these reasons are outside of the realm of this example so we will just get right to the example.
Creating a static route on a Cisco device is relatively straight forward. From a privileged exec mode you enter global configuration. This is where the routes are created. The syntax for a basic static route is very simple.
ip route AAA.AAA.AAA.AAA MMM.MMM.MMM.MMM NNN.NNN.NNN.NNN
AAA.AAA.AAA.AAA = Address of the network the route is for
MMM.MMM.MMM.MMM = Network Mask for the route being applied
NNN.NNN.NNN.NNN = the next hop address (the next router on the path)
Another version of the syntax is as follows:
ip route AAA.AAA.AAA.AAA MMM.MMM.MMM.MMM type#/#
AAA.AAA.AAA.AAA = Address of the network the route is for
MMM.MMM.MMM.MMM = Network Mask for the route being applied
type#/# = Interface type followed by card/port number (e.g. Gi0/12)
With these details look at the example to see how static routes were created on all four routers to provide layer three connectivity to all devices in the network. Note how many static routes were required on each device. You can easily see how managing statics routes quickly becomes a boon.
hostname R1 ! interface Serial0/0 ip address 172.16.0.1 255.255.255.252 ! interface Serial0/1 ip address 172.17.0.1 255.255.255.252 ! ip classless ! ip route 172.17.0.0 255.255.255.252 172.17.0.2 ip route 172.18.0.0 255.255.255.252 172.17.0.2 ip route 172.18.0.0 255.255.255.252 172.16.0.2 ip route 172.19.0.0 255.255.255.252 172.17.0.2 ip route 172.19.0.0 255.255.255.252 172.16.0.2 ! end
hostname R2 ! interface Serial0/0 ip address 172.16.0.2 255.255.255.252 ! interface Serial0/2 ip address 172.19.0.2 255.255.255.252 ! ip classless ! ip route 172.17.0.0 255.255.255.252 172.16.0.1 ip route 172.17.0.0 255.255.255.252 172.19.0.1 ip route 172.18.0.0 255.255.255.252 172.19.0.1 ip route 172.18.0.0 255.255.255.252 172.16.0.1 ! end
hostname R3 ! interface Serial0/1 ip address 172.17.0.2 255.255.255.252 ! interface Serial0/2 ip address 172.18.0.1 255.255.255.252 ! ip classless ! ip route 172.16.0.0 255.255.255.252 172.17.0.1 ip route 172.16.0.0 255.255.255.252 172.18.0.2 ip route 172.19.0.0 255.255.255.252 172.17.0.1 ip route 172.19.0.0 255.255.255.252 172.18.0.2 ! end
hostname R5 ! interface Serial0/0 ip address 172.19.0.1 255.255.255.252 ! interface Serial0/1 ip address 172.18.0.2 255.255.255.252 ! ip classless ! ip route 172.16.0.0 255.255.255.252 172.19.0.2 ip route 172.16.0.0 255.255.255.252 172.18.0.1 ip route 172.17.0.0 255.255.255.252 172.18.0.1 ip route 172.17.0.0 255.255.255.252 172.19.0.2 ! end