I used NetworkManager to connect to a openVPN server. It is configured such that all traffic passes through the VPN:

> ip route                    
default via dev tun0  proto static  metric 50 
default via dev wlp2s0  proto static  metric 600 

with being the peer address of the tun0 device. The second route routes traffic through my local router. In an attempt to remove the default route, I issued the command:

ip route del default via dev tun0

which does not throw an error, but does not alter the routing table neither. What is the right way to remove that route?


The ip route del command looks not wrong to me. If it doesn't work, you either have to specify all properties or the route (that is, everything that ip route show prints, including 'metric' and 'proto') or you might get away with it by omitting the 'via' part.

Anyway, if you do this, NetworkManager may restore the route later and it certainly restores it upon re-activating the OpenVPN connection.

Probably, you should do nmcli connection modify $OVPN_CONN_NAME ipv4.never-default yes

See man nm-settings.

  • 1
    I found that my command actually deleted the route, but NetworkManager discovered that and quickly set it up again. BTW, the option "ipv4.never-default yes" corresponds to the checkbox "Use this connection only for resources on its network' in NetworkManager's connection-editor – jan Sep 29 '16 at 11:40

You need to see if it is an openvpn configuration or a network-manager parameter.

The redirect-gateway option can be pushed by server or setup by client config, you have just to remove/comment it.

For network-manager, see that serverfault post


I had the same problem deleting a default route that was added for a second interface upon boot. The correct command with the proper selector is the following:

ip route del to default via

That will delete only the route on the interface. The op was missing "to" as the selector.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.