How to configure Static Routing in a Cisco Router

Routers send packets to various networks based on the information available in the router's routing table. Routers learn about the networks that are directly connected, based on the IP addresses configured on their interfaces.

Directly networks are automatically included in the routing table, which is then used for sending packets to destinations belonging to them.

We must configure the networks in router which are not directly connected. We can configure the routes statically or dynamically (with the help of routing protocols)

To create a static route in a Cisco router, we must use the "ip route" command.

When using the ip route command, you can identify where packets should be routed by either 1) The next-hop address or 2) the interface to exit


How to configure a Static Route using the next-hop address


Router(config)#ip route 10.10.40.0 255.255.255.0 10.10.10.2


Where, 10.10.40.0 = destination network, 255.255.255.0 = Subnet mask of the destination network, 10.10.10.2  = next-hop address

We can explain this as - to get to the destination network of 10.10.40.0, with a Subnet mask of 255.255.255.0, send all packets to 10.10.10.2

How to configure a Static Route using the exit interface


Router(config)#ip route 10.10.40.0 255.255.255.0 s0/0


Where, 10.10.40.0 = destination network, 255.255.255.0 = Subnet mask, s0/0  = interface to exit

We can explain this as - to get to the destination network of 10.10.40.0, with a Subnet mask of 255.255.255.0, send the packets via s0/0 interface 

The "permanent" keyword

The "permanent" keyword in a static route statement, will keep the route even if an interface goes down. If you have a loose serial cables or a UTP cable an interface can go down. If the interface is down, plugging back the cable will not make it up. We can use the permanent keyword in your ip route command to avoid this.
 

1 comment: