OpenVPN connecting but no internet access on Ubuntu 16.04 / 18.04 / 20.04
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!
Solution 1:
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:
Then mark Use this connection only for resources on its network
.
Click Ok
, then Save
and reconnect.
Solution 2:
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 202.67.222.222 and 208.67.220.220 the link
Solution 3:
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
0.0.0.0 10.211.1.2 128.0.0.0 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 172.16.156.65
or for traffic routing through vpn
sudo ip route add default via 10.211.1.2
After that you can add more route
Example, if you wont to go to 106.158.15.233
via wlan0
ip route add 106.158.15.233/32 via 172.16.156.65 dev wlan0
or via vpn
ip route add 106.158.15.233/32 via 10.211.1.2 dev tun0
172.16.156.65
is address of your wifi router
10.211.1.2
is address of your vpn server
Solution 4:
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.
Solution 5:
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...
[Solve]
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.