Static Routing is a form of routing that occurs when a router uses a manually configured routing entry, rather than information from a dynamic routing traffic. In most cases, static routes are manually configured by the sysadmin by adding entries into the router's routing table. Unlike dynamic routing, static routes are fixed and do not change if the network is reconfigured. The main advantage of static routing may be to avoid CPU consumption like the dynamic routing. Static routing is very easy to configure on small networks as we're about to demonstrate, however as networks scale up, static routing becomes largely inefficient.
Static or Dynamic routing comes into play when we need networks (1 gateway, X amount of hosts) to be able to communicate with each other. As we saw earlier, when there is only 1 router, we can access the gateway, and the gateway on the other side of the router, including the hosts under the opposite side gateway. However in this example below, we'll realise that there needs to be static routing due to the increase in hops that needs to be made to reach the destination network
Let's suppose the following network configuration:
First we configure the routers on the edges to provide a gateway for network A (PC2-0) and network B (PC3-4)
Network A (Router3):
Router>en
Router#conf t
Router(config)#int gig0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int gig0/1
Router(config-if)#ip address 10.1.0.1 255.255.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#exit
Router#copy run start
Router#exit
Network B (Router4):
Router>en
Router#conf t
Router(config)#int gig0/0
Router(config-if)#ip address 192.168.2.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int gig0/1
Router(config-if)#ip address 10.2.0.1 255.255.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#exit
Router#copy run start
Router#exit
Now that's done, we get this result:
We need to configure Router2, the one in between:
Router>en
Router#conf t
Router(config)#int gig0/0
Router(config-if)#ip address 10.2.0.2 255.255.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#int gig0/1
Router(config-if)#ip address 10.1.0.2 255.255.0.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#exit
Router#copy run start
Router#exit
Which gives us this result:
On the surface it looks like we are able to communicate from network A to network B, so let's try that, but before let's assign the default gateway, and the ip adresses on each individual PC:
Once that's done, try to make them ping each other: (remember, this is different from earlier, here we have 3 hops)
And here we see the main problem, we are not able to ping from one network to another because our ping (ICMP) packets cannot reach the other side, Although as we saw earlier, we should still be able to ping the other side of the first router.
So that's where Routing comes into play, we will get into Router3, Router2 and Router4's CLI to determine the destination network, AND the next hop needed to get there. But first let's rename them to be easier to follow with:
RouterC>en
RouterC#conf t
RouterC(config)#ip route 192.168.2.0 255.255.255.0 10.1.0.2
RouterC(config)#exit
RouterC#copy run start
RouterC#exit
RouterC>
RouterB:
RouterB>en
RouterB#conf t
RouterB(config)#ip route 192.168.2.0 255.255.255.0 10.2.0.1
RouterB(config)#exit
RouterB#copy run start
RouterB#exit
RouterB>
But we need to do the same on the other way around! Because if we try to ping the other network, our ping request may reach the other network, but how can their response Reach our network without any routing on the other way around ?
RouterA:
RouterA>en
RouterA#conf t
RouterA(config)#ip route 192.168.1.0 255.255.255.0 10.2.0.2
RouterA(config)#exit
RouterA#copy run start
RouterA#exit
RouterA>
RouterB:
RouterB>en
RouterB#conf t
RouterB(config)#ip route 192.168.1.0 255.255.255.0 10.1.0.1
RouterB(config)#exit
RouterB#copy run start
RouterB#exit
RouterB>
Once that's done, we try to ping from one network to another (which goes through the 3 routers we just configured)
And that's it! We have been able to configure 3 routers using static routing.
As you saw, in order to link 2 networks with each other using static routing we had to configure All 3 routers in between for packets coming in AND coming out, don't forget that the static routing is only a one way path, there has to be a configuration for each router for each distant network, which, of course, becomes extremely painful to configure if you end up with a network configuration like this:
5 networks * 5 routers = 25 static routing configurationsThat is why dynamic routing comes into play, to solve this problem.
Next Chapter: Dynamic Routing
Until there is Nothing left.
Creative Commons Zero: No Rights Reserved
Donate XMR: 8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8
Contact: nihilist@contact.nowhere.moe (PGP)