Configuring the Static Routing on a Cisco Router

iconHow does a router know which “hops” are available to it when deciding where to send packets? Well, it could go out and communicate with the hosts directly with it, but that’s tedious when all it wants to do is relay the packets. That makes static routing a good option for telling routers which IP addresses to send packets to.

The IP Route Command

The ip route command can be used to determine the next-hop address or the exit interface to send packets to. This is done in the Global Configuration (Router(config)#) mode.

  • Next-hop address: This sets the destination network, subnet mask, and next-hop address: ip route 172.16.20.0 255.255.255.0 172.16.10.2. This tells the router the next-hop address (172.16.10.2) that a packet needs to be sent to so it can reach the network with an IP address of 172.16.20.0 and subnet mask of 255.255.255.0.
  • Exit Interface: Just like it sounds like, you’re using the interfaces connected to the router to create the IP route. The command for this method looks like, ip route 172.16.20.0 255.255.255.0 serial 0/0/0, which tells the router to use the serial 0/0/0 interface to send packets to the network with an IP address of 172.16.20.0 and subnet mask of 255.255.255.0.
  • The Permanent Keyword: This is an optional keyword to prevent the router from loosing its configured static routes if it goes down. Add it to the end of the ip route command, like this: ip route 172.16.20.0 255.255.255.0 172.16.10.2 permanent.
  • Administrative Distance: This is another option that basically rates the reliability of a particular route. The rating ranges from “0” for a directly connected route (extremely reliable) to 255 for an unknown route that shouldn’t be relied on. A static route is automatically assigned an administrative distance of 1. If you are creating backup routes, you can create a floating static route by setting the administrative distance to a number that is higher than the routing protocol you are using. To set the administrative distance of a route, the command would look like, ip route 172.16.20.0 255.255.255.0 172.16.10.2 200.

AdministrativeDistances

  • Default Route: This sends packets destined for networks not in your routing table to a specified address or interface. The command can be either ip route 0.0.0.0 0.0.0.0 172.16.10.2 for sending the packet to a specific IP address, or ip route 0.0.0.0 0.0.0.0 serial 0/0/0 for sending it to a specific interface.
  • Verifying Your Routes: Returned to Privileged mode (Router#) and type in show ip route to see the IP routing table. This is very useful for making sure you typed in all the IP addresses correctly.

A Few Routers To Check Out

iconiconiconiconicon