1.2.c Static routing

A static route is a manually configured route and will have a default administrative distance of 1.

You can configure an IPv4 static route using this command:

R1(config)# ip route <prefix> <mask> {interface | next-hop}

For IPv6, the command is very similar:

R1(config)# ipv6 route <prefix>/<length> {interface | next-hop}

If you choose to use an interface instead of the next-hop address, the static route will be removed from the routing table if the interface in the command goes down.  If the interface comes back up the route will return.  You can override this behavior by adding the permanent keyword to the end of the route statement.  This will keep the route in the table even if the interface goes down.

A floating static route is a static route that has an AD manually configured to be higher than the AD of a routing protocol in use.  This is done so the route is not used unless the routing protocol loses the route.

An example of a floating static route would be a destination in the 172.16.1.0/24 network via the next-hop address of 10.255.255.254 and then changing the administrative distance to 250 (from 1).

Router(config)# ip route 172.16.1.0 255.255.255.0 10.255.255.254 250

Note that you will not see this route in the routing table if your routing protocol has a better route available for that network.

Recursive lookups with static routes

When you use a next-hop address with a static route, the router will have to look at the routing table twice.  The first time is to find the route, and the second time will be to resolve the route to the next-hop address.

R1#sh ip route static 
      150.1.0.0/32 is subnetted, 2 subnets
S        150.1.4.4 [1/0] via 155.1.146.4
R1#sh ip cef 150.1.4.4 detail 
150.1.4.4/32, epoch 0
  recursive via 155.1.146.4
    attached to GigabitEthernet0/2

It is recommended to use an interface instead of the next-hop address on point-to-point links.  On a broadcast network, if the next hop address is always out the same interface then you should use both the exit interface AND the next-hop address.  Avoiding using just the next-hop address will save the router from doing recursive lookups.

Add the interface to the static route in the hopes that recursive lookup is no longer required:

ip route 150.1.4.4 255.255.255.255 GigabitEthernet0/2 155.1.146.4

Verify the static routing output:

R1#sh ip route static         

      150.1.0.0/32 is subnetted, 2 subnets
S        150.1.4.4 [1/0] via 155.1.146.4, GigabitEthernet0/2

After adding the interface to the route no recursive lookup is performed (the keyword recursive is missing).

R1#sh ip cef 150.1.4.4 detail 
150.1.4.4/32, epoch 0
  nexthop 155.1.146.4 GigabitEthernet0/2

Verification

Here are the commands to verify both IPv4 & IPv6 static routes:

R1# show ip route
R1# show ipv6 route

Comments

So empty here ... leave a comment!

Leave a Reply

Sidebar