Configure a Null Static Route

A null static route sends network traffic to a null interface, where the network packets are discarded.

About this task

You can use a null static route to handle traffic that should not be forwarded because the preferred route is unavailable. The following figure depicts how a null static route works with a standard route to the same destination.
Click to expand in new window
Null route and standard route to same destination

Procedure

  1. Access global configuration mode.
    device# configure terminal
    
  2. Configure the preferred route to a destination.
    device(config)# ip route 192.168.7.0/24 192.168.6.157
    
    This example creates a static route to destination network addresses that have an IP address beginning with 192.168.7.0. These destinations are routed through the next-hop gateway 192.168.6.157. The route carries the default metric of 1.
  3. Configure a route to the same destination, followed by the keyword null, a space, and a zero. On the same line, enter a cost metric that is higher than the metric for the preferred route.
    device(config)# ip route 192.168.7.0/24 null 0 2
    
    This example creates a null static route to the same destination. The metric is set higher so that the preferred route is used if it is available. When the preferred route becomes unavailable, the null route is used, and traffic to the destination is dropped.

Example

The following example summarizes the commands in this procedure.

device# configure terminal
device(config)# ip route 192.168.7.0/24 192.168.6.157
device(config)# ip route 192.168.7.0/24 null 0 2