Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm configuring some network stuff, and every time I try something the connection breaks. Thinking that I must be configuring something incorrectly to break all connections, I did a bit of troubleshooting, to find out that on a fresh boot all networks are working. If I run the command ip rule flush I lose all connectivity until I reboot.

I'm using Kubuntu 12.04 network manager connecting via wireless adapter. Any help appreciated

share|improve this question

migrated from Sep 23 '12 at 20:35

This question came from our site for system and network administrators.

could you post the output of 'ip rule show' just after reboot? – Serge Sep 23 '12 at 17:07

I believe this is to be expected.

When you boot there is a rule numbered 32766, as follows:

 32766: from all lookup main

main is the route table normally set up, so unless you have made special preparations you need it. When you enter the ip rule flush command it is deleted.

You can add this rule again after flushing by executing:

 sudo ip rule add from all lookup main pref 32766

I tried this out and, like you, when I did the flush I lost connectivity, and when I re-added it I regained it.

This is the normal set of rules on my 12.04 Ubuntu system:

 0: from all lookup local   
 32766: from all lookup main   
 32767: from all lookup default   

Similarly you could also:

ip rule add from all lookup default pref 32767

So the script should be something like this:

ip rule flush

ip rule add from all lookup main pref 32766

ip rule add from all lookup default pref 32767

share|improve this answer

are you sure you are not trying to do the following command instead?

ip ru flush cache

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.