24

In Ubuntu 16.04 I had no problems with VPN: after disconnecting I had Internet.

In Ubuntu 18.04 I have no Internet after disconnecting from the VPN. I can actually ping 8.8.8.8 but not www.google.com hence I'm thinking DNS related issue.

A manual solution is to do $ sudo service network-manager reload.

  1. What is causing the problem in Ubuntu 18.04, and
  2. How do we fix it permanently?
  • Add 'dns=dnsmasq' to /etc/NetworkManager/NetworkManager.conf then 'sudo systemctl restart NetworkManager'. Haven't tried it myself. Credit goes to riptag100. privateinternetaccess.com/archive/forum/discussion/28717/… – Val Dec 3 '18 at 16:09
  • the @Val's solution is not working for me. It makes all VPNs to disconnection immediately. – HosseinAgha Jan 30 '19 at 16:54
  • Update: I had to install OpenVPN for unrelated reasons ($ sudo apt install network-manager-openvpn-gnome). Going to Settings > Network > Add VPN I now have an OpenVPN there as well and using that to set up my VPN no more issues. Can disconnect VPN and have Internet immediately afterwards. For me this was a painless fix. – Daniel Apr 8 at 21:02
26

It could be related to this bug: https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1778946

SOLUTION

Edit the file /etc/ppp/ip-up.d/0000usepeerdns

Replace the following line:

cp -a "$REALRESOLVCONF" "$REALRESOLVCONF.pppd-backup.$PPP_IFACE"

With this code:

cp "$REALRESOLVCONF" "$REALRESOLVCONF.pppd-backup.$PPP_IFACE"
chmod 644 "$REALRESOLVCONF.pppd-backup.$PPP_IFACE"

Restart the network manager:

systemctl restart NetworkManager
| improve this answer | |
  • Same or similar problem: after using vpn (Cisco any_connect) I can no longer open pages on the server I used for the vpn; all other sites work. Followed xezpeleta's recipe above but problem stays. – Rob Rutten Sep 1 '19 at 8:40
  • can i do the same in my ubuntu interface somehow? – stiv Dec 18 '19 at 12:19
  • 1
    Thanks, it worked. – Alex Rešatniak Apr 15 at 15:35
  • Thanks, it worked for as well. – Kenjiro Jul 24 at 5:16
  • I am facing similar issue. I disconnect from the VPN (netExtender) and the DNS doesn't work anymore. I have to restart the WiFi. I have edited the file, I replaced the line, but for me it didn't fix the problem. – razvang Oct 9 at 10:56
0

I had a similar but different problem. When my Debian 4.19.37-5+deb10u1 loaded, it started NordVPN Version 3.2.0-4 . Whenever I disconnected the VPN, I had no internet connection. Though, local network was still accessible and DNS returned the correct IPs when attempting an internet ping. NordVPN would not reconnect. My only option was to reboot.

None of the solutions presented previously worked for me. Not even restarting manually the network manager service.

I had to uninstall (purge) and reinstall NordVPN following those instructions: https://support.nordvpn.com/Connectivity/Linux/1322207652/Troubleshooting-connectivity-of-Linux-app.htm

Now, I can connect and disconnect NordVPN as much as I want and I have internet access as expected in both situations. Still works after reboot.

| improve this answer | |
0

The issues is with how to manage the /etc/resolv.conf. I removed manually the nameserver added by VPN client and restarted the NetworkManager.

/etc/resolv.conf before VPN:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 14.139.5.5
nameserver 8.8.8.8

/etc/resolv.conf after VPN:

nameserver 10.200.4.1
nameserver 10.200.4.1
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 14.139.5.5
nameserver 8.8.8.8

I removed the top 2 nameserver lines and restarted NetworkManager: systemctl restart NetworkManager.

| improve this answer | |
0

you need to kill the process, in terminal run the following:

ps -aux | grep vpn

find your process id:

proccesses

in my case it was 14286

so I ran

sudo kill -9 14286

and, Hola! I can connect to the internet again :)

| improve this answer | |
-1

Try this, it worked for me.

Disconnect from VPN

sudo rm /etc/resolv.conf
sudo gedit /etc/resolv.conf

add: "nameserver 8.8.8.8" then save

sudo service network-manager reload
| improve this answer | |
  • 4
    Hello and welcome to Ask Ubuntu! I don't think hardcoding Google DNS in /etc/resolv.conf is a good idea. What if the OP needs his own DNS while connected to the VPN? Also, please keep in mind that in a "default" Ubuntu installation, resolv.conf gets overwritten automatically at each reboot. – Mr Shunz Dec 22 '18 at 13:44

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.