I'm trying to connect to a VPN using OpenVPN.

I tried using network-manager with OpenVPN plugin and tried too in terminal with ovpn.conf file.

Everything connects (it says connection established) in terminal, but no internet access.

I can ping anything, not even the gateway of the tunnel.

Here is what I tried

I've tried:

  • disable ufw;
  • tried several config files;

Same result.

Tried ticked the option under VPN configaration > IPv4> routes > use this connection only for resources on its network. After this, the internet worked again and the VPN shows connected. But my traffic is not encrypted and IP and location still the same. At last, I tried --redirect-gateway option, still no use.

I'm out of my league now. Please help. Thanks for reading!

  • You wish all traffic go through vpn tunnel?
    – 2707974
    Aug 3, 2015 at 7:03
  • thanks for commenting and yes.imean my location stayed the same. Aug 3, 2015 at 8:48
  • Please, put output in you question from command traceroute when you are connected to vpn and also output form command route -n when you are connected.
    – 2707974
    Aug 3, 2015 at 8:51
  • i added the output traceroute was going nowhere so i ended it Aug 3, 2015 at 9:24

10 Answers 10


I'm using the gnome network manager with OpenVPN Network Manager plugin.

You can install it with:

sudo apt-get install network-manager-openvpn-gnome

My connection is working fine if I try directly with OpenVPN. But if I try using Network Manager, it works, but no internet access.

To fix this, edit the OpenVPN connection configuration on Network Manager and click in IPv4 Settings tab, then click in Routes button:

IPv4 tab

Then mark Use this connection only for resources on its network.

IPv4 routes

Click Ok, then Save and reconnect.

  • 19
    This is definitely the correct answer.
    – ccpizza
    Jul 23, 2016 at 7:27
  • 4
    This worked for me on 16.04 as well.
    – marts
    Sep 27, 2016 at 16:30
  • 6
    While this allows internet access, your internet access won't be encrypted if you do this, correct? I tried this and it was showing my actual IP in browser tests.
    – gammapoint
    Apr 6, 2017 at 11:59
  • 3
    Note that for me it indeed restored the internet connection but broke the domain name resolution of the VPN network (handled by dnsmasq). To solve that I had to explicit the IP of the DNS server of the internal network in the "Other DNS" field of the "IPv4" tab of the VPN connection configuration dialog and restart the connection.
    – jmon12
    Sep 11, 2020 at 15:23
  • 5
    This works with the default network manager on ubuntu 20.4 as well Jun 11, 2021 at 8:21

i fixed the openvpn no internet issue also

first completely remove openvpn and autoremove after that then add ppa as shown in the link and execute the commands one by one then yu should be good to go .. and if no dns issue add opendns at resolv.conf its and the link

  • This works together with the network-manager-openvpn-gnome package, excellent, thank you!
    – SNH
    Sep 1, 2015 at 13:26
  • yup i never found a working thread for this . but nice to know my half assed meddling help somebody . much appreciated man :') Sep 1, 2015 at 15:05
  • If you don't want to route normal traffic through vpn, then there is absolutely no need to install extra ppa's and different builds. The current networkmanager plugin works fine via the GUI: myopenvpn -> Edit -> IPv4 Settings > Routes > enable "Use this connection only for resources on its network". The answer from @Rael should be the accepted one.
    – ccpizza
    Jul 23, 2016 at 7:36
  • @ccpizza The question and OP are deliberately asking for all network traffic to be routed through the VPN. Thus Rael's answer should not be the accepted one here, even if it is what most people who land here are looking for.
    – Emil S.
    Mar 12, 2021 at 9:54

Problem makes routes. To be precise, default route.

First, if you wish to route all traffic trough vpn in NM you do not check option "use this connection only for resources on its network".

Second problem is route about default gw UG 0 0 0 tun0

Problem can fix with manual adding route or check configuration on vpn server.

To set manual route for all traffic go to tun0 after connecting to vpn put command

ip route add default via ip_address_of_vpn_server

Edit 1

Wait, you can add default route aka default, if you wish traffic go to wlan0 with command

sudo ip route add default via

or for traffic routing through vpn

sudo ip route add default via

After that you can add more route

Example, if you wont to go to via wlan0

 ip route add via dev wlan0

or via vpn

 ip route add via dev tun0 is address of your wifi router is address of your vpn server

  • You have my edit 1
    – 2707974
    Aug 3, 2015 at 10:32
  • i added another answer . not working :( Aug 3, 2015 at 11:22
  • And now something completely different. Remove any configuration for vpn, client, config in NM. After that restart pc. This will back us on begining. We will get clear routing table. Try agan with NM. When you connected give me output from route -n.
    – 2707974
    Aug 3, 2015 at 11:40
  • did it and gave the output in EDIT 2 thanks for bearing with me .. just cant get internet through vpn and dont want to go back to windows .i should mention again it worked few times rather than that no connectivity Aug 3, 2015 at 12:31
  • Ok, now we are clean. Your wifi router is on Now create connection to vpn server in NM. Go to NM then vpn then add vpn server address, user, pass. If work this is it if not. When you are connected do route -n We must see with route add vpn.
    – 2707974
    Aug 3, 2015 at 12:40

You can simply solve this issue by turning on your firewall. In Linux Mint, i went to Firewall Configuration and turned on the Firewall. After that I connected VPN and there was no problem. I hope that helps.


I know this is old but I dont have a working solve to this problem from this thread and have a similar problem.

Here is my problem. I downloaded my openVPN keys from my router. installed on Linuxmint Virtual machine and ElementaryOS both Virtual and Host OS on a laptop.. Both versions give the same problem. VPN connects but has absolutely no traffic through it. Enabling "use this connection only for resources on its network" is completely useless and i still don't get access to the vpn network resources anyways. scratch that...

Here is what I did.. I noticed some said when they connected via command line vpn seemed to work. the problem must resides in the fact you can not import the openVPN configuration. so i pulled out my trusty text editor opened the openvpn .conf file. I noticed in the openvpn connection profile it had an "advanced" tab. with lots of various options. So I attempted to translate all the config options into the advanced tab and what do you know... it worked...


So i did it again on the laptop with a different distro.. I changed options One by One this time checking the vpn each time and the vpn started functioning after i configured the compression.

Under Connection Settings VPN > Advanced button > Check Use LZO Data Compression (I set to adaptive) and the tunnel started functioning no issues and "My IP" shows as the vpn router's external IP.

There is no special configs or firewall or anything in my experience. Just need to set all the options the same as the config file and you can use the built in network manager to handle it.


For those who are using ubuntu 18.04 and have no access to network-manager-openvpn-gnome I found a solution that worked for me. As far as I know is just a different way to do the same configuration.

sudo vi /etc/NetworkManager/system-connections/<name of your vpn connection>

In the section ipv4 you append a new line: never-default=true


After you should restart your NetworkManager

sudo systemctl restart NetworkManager.service

I know the issue may have been resolved, but in my case the solution didn't survive a reboot. So, I found another solution for the openvpn terminal not giving internet access on Ubuntu 14.04 by adding --management localhost 1194 to the arguments. Like:

root@user /# openvpn --config file.ovpn --management localhost 1194.

It's handy if you don't want to split the config file to the 3 other files for use from the network-manager applet.


The best solution I've found is to open a terminal and do the following:

sudo gedit /etc/resolvconf/resolv.conf.d/head

in the file that opens up, add the following:


save the file and run the following command in a terminal:

sudo resolvconf -u

Try connecting to your OpenVPN server now. You should be good to go!

  • Didn't work for me. Also that file says "DO NOT EDIT THIS FILE BY HAND"
    – Mark
    Jul 19, 2016 at 7:35

I had the same problem. when you config openvpn , the firewall is necessary. you should configure a firewall and pass openvpn traffic through the firewall.


Сheck the metric of routes with the command ip route: if the metric tun0 is less than the default interface metric, then all traffic will go through OpenVPN and there will be no internet.

You can change the metric by editing the file in the directory /etc/netplan/ (some examples in Netplan configuration examples), then run netplan apply.

Сhecked for Ubuntu 18.04 / 19.10 / 20.04, everywhere the standard client was used NetworkManager and editing helped everywhere.

You must log in to answer this question.

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