2

I'm currently playing with setting up an OpenVPN Access Server in AWS. For the most part I've got everything working, except when I try to add the VPN connection to Ubuntu using the networks GUI.

This is my routes -n output when I'm not connected to the VPN,

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U     9      0        0 wlan0

The VPN is configured to not route internet traffic. So when I connect via the command line using sudo openvpn client.ovpn everything works as expected and my routes -n looks like the following,

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0
54.173.232.46   192.168.0.1     255.255.255.255 UGH   0      0        0 wlan0
172.16.0.0      172.16.224.129  255.255.254.0   UG    101    0        0 tun0
172.16.224.0    172.16.224.129  255.255.255.0   UG    101    0        0 tun0
172.16.224.128  0.0.0.0         255.255.255.128 U     0      0        0 tun0
192.168.0.0     0.0.0.0         255.255.255.0   U     9      0        0 wlan0

Take note of the default route 0.0.0.0 hitting my router 192.168.0.1. If I try and hit Google, all works as expected.

I don't want to have to connect to the VPN via command line everytime so I installed network-manager-openvpn-gnome and imported the client.ovpn when creating the VPN.

Now when I connect via the network dropdown in the tool bar, the VPN connects fine, but I can't access Google or any other website. I can access servers in my AWS VPC, but that's it.

Interestingly my routes -n now looks like the following,

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.224.129  0.0.0.0         UG    0      0        0 tun0
54.173.232.46   192.168.0.1     255.255.255.255 UGH   0      0        0 wlan0
172.16.0.0      172.16.224.129  255.255.254.0   UG    101    0        0 tun0
172.16.224.0    172.16.224.129  255.255.255.0   UG    101    0        0 tun0
172.16.224.128  0.0.0.0         255.255.255.128 U     0      0        0 tun0
192.168.0.0     0.0.0.0         255.255.255.0   U     9      0        0 wlan0

Note the default route is no longer pointing at my router.

Unless I'm being blind I can't find an option in the networks GUI where I can fix this.

Any ideas?

Thanks

2
  • What do your config files look like? I'm guessing the GUI puts them in /etc/openvpn/. Could there be more than one in there?
    – Edwin
    Nov 26, 2014 at 13:42
  • @Edwin Found the option. Added the answer. Nov 26, 2014 at 13:58

2 Answers 2

12

Turns out I was being blind.

Edit the VPN connection -> IPv4 Settings -> Click "Routes", and finally check "Use this connection only for resources on its network".

2
  • 2
    Dude, after hours and hours of searching the internet i found your answer and it worked, pfff don't even know where to start thanking you! Have an awesome day!
    – Mr. Sam
    Jun 11, 2018 at 11:55
  • Oh man, I know comments shouldn't be used for this, but I had to remove that route manually, and I just wanted to thank you for returning with the answer :)
    – AFP_555
    May 21, 2020 at 6:28
2

The accepted answer did not work for me on Fedora 31 and NetworkManager. I was able to resolve by modifying /etc/NetworkManager/system-connections/vpn_name

[vpn]
...
never-default=true
...

Then restart NetworkManager with

sudo systemctl restart NetworkManager

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .