Static routing is likely used routing method in small networks with simple topologies, for quick creation and testing interconnections, and for backup if primary routes fail.
Do not use static routing in large networks and networks where are scaling expected.
In this example, I will build up a simple network and show static routing, static route summarization.
The routers by default can route on the directly connected interfaces, they learn the IP addresses of their first neighbors. For every other router that is outside of the sight of them, we have to configure a static route or dynamic routing protocol. This example will show the way of configuring a static route.
On the image, I pointed out which networks are unknown for which device, we can see that R1 doesn’t know about the 192.168.2.0 network and the 10.1.1.0 network, and so on…
By the topology, the traffic for the networks unknown by our networks has to be sent through NetRouter to the internet.
For now, the PC0 can ping only the interfaces on the router R1, The ICMP(ping) can reach the Fa0/0 on R2 and Fa0/1 on R3 but the packet is dropped by those routers because they have no route to the 192.168.1.0 network, on which is the PC0.
The output of the Ping from PC0 to 188.8.131.52 (R2) is giving the “Request timed out.” notification.
Let’s start the configuration of the static routes: To follow the example, and to make sure the success of the ping from PC0 I will configure the static routes on R1 and R2 with the command: ip route *ip address* *interface* OR the *next hop ip address*
- R2 to the network 192.168.1.0.
- R1 to the 192.168.2.0
After command, the ping will succeed, from pc0 to pc1.
The next step will be to configure the route for the distant traffic, so the default route for all the unknown traffic distant from our network. For that, we are using the same command as previous instead of the ip address and the mask will be all zeros ( ip route 0.0.0.0 0.0.0.0 *interface or ip next hop* ). in the current example we will use interface pointing to the switch, and on the switch, we have defined the default gateway of 184.108.40.206 ( R3).
On the R3 we will point the default route to fa0/0 – to the NetRouter.
For R3 and NetRouter we can use route summarization technique, which will allow us to use fewer commands for routing traffic to the networks 192.168.1.0 and ..2.0.
The summarization is happening by defining the common part of networks and defining the route by the ip and mask that will cover both of them.
for 192.168.1.0 and 192.168.2.0 the common part is the first 22 bits:
11000000.10101000.00000001.00000000 AND 110000000.10101000.00000010.00000000 – so we can configure: ip route 192.168.0.0 255.255.252.2 …
This will cover both networks in the same direction of gig0/0 on NetRouter and fa0/1 on R3.