In Linux How To Flush Routing Table From Cache

Routing Table

Static routes are much important if you have more than one interface connecting to different subnet. Enabling static routes gains much performance for your network. Either of the two below commands can be used to set/delete static routes.

1) ip route
2) route

This page I am not referring about how to add/delete static route but would like to explain how to flush the routing table using “ip route” command. Sometimes network get messed because of routing table cache. Below commands displays current routing table.

# ip route show

Or

# route -n

or

#netstat -nr

Next question would be, how to clear the routing table?

You can try any of the below command to flush cache:

#/sbin/ip route flush table all /*this command will totally wipe your routing table completely clean */

or

#/sbin/ip route flush table main

But remember what is mentioned in the Redhat Link

For persistent static route, you can place routes in any of the below file:

#vi /etc/sysconfig/static-routes (this file is called by /etc/sysconfig/network-scripts/ifup-routes each time an interface is
brought up)

or in

#vi /etc/sysconfig/network-scripts/route-eth0

About Bobbin Zachariah

Founder of LinOxide, passionate lover of Linux and technology writer. Started his career in Linux / Opensource from 2000. Love traveling, blogging and listening music. Reach Bobbin Zachariah about me page and google plus page.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.