Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Is there a way to change the gateway of an existant VPN connection with a command line? Changing the gateway value in the connection file with sed doesn't work for me.


share|improve this question

1 Answer 1

There are at least two ways to change the default gateway on a modern Linux system:

  1. Using the traditional route change default gw gateways_ip ethX
    Advantage: Works on all unix like systems.
    Alternative: route delete follow by a route add. Do not try this when connecting remotely.
  2. Using the ip command.
    ip route { add | del | change | append | replace | monitor } ROUTE
share|improve this answer
Maybe I should edit it to 'newer'. Personally I only discovered that command a year ago, despite using unix-alikes since 1991. (mostly slackware 2.4, 3, severals BSD etc etc). – Hennes Apr 14 '13 at 12:48

Your Answer


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

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