Managing the routing cache with linux

After changes to network routing or the firewall on gateway linux systems, a flush of the routing cache may be required to stop previous settings from being used.

To view the current routing cache use the following command:

route -Cn
Kernel IP routing cache
Source          Destination     Gateway         Flags Metric Ref    Use Iface
10.71.193.202   192.168.0.100   192.168.0.100   l     0      0       21 lo
192.168.0.100   10.101.168.74   192.168.0.1           0      0        2 wlan0
.....

To clear the current routing cache issue the following command as root:

echo 1 > /proc/sys/net/ipv4/route/flush

The route command above should now display an empty cache.

Last updated: 08/08/2010