Flushing the linux routing cache

In order to clear the network routing cache in linux the following command is needed.

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

Old versions of linux may require the command below instead:

echo -e -n "\\0" > /proc/net/rt_cache

Once this has been done, the kernel routing table cache should now be empty, as shown by the command below:

route -C

Kernel IP routing cache
Source          Destination     Gateway         Flags Metric Ref    Use Iface

Last updated: 21/11/2011