In Linux How To Flush Routing Table from Cache

| February 25, 2011 | 0 Comments

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) iproute
2) route

This page I am not referring about how to add/delete static route but like to explain how to flush the routing table using “ip route” command. Sometime 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

For persistant 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

Tags: , , , , ,

Category: Linux Administration

Leave a Reply

You must be logged in to post a comment.