No Internet connection after disconnecting from VPN in Ubuntu 18.04

22,308

Solution 1

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

Solution 2

OK, so I faced the same problem. My VPN was connected then I pressed CTRL + ALT + F11 then It went into some kind of sleep mode, and then I had to restart my laptop after long pressing power button. So then my internet and Gs connect stopped working, I uninstalled proton vpn but the problem still persisted, So what I did was just reinstalled protonvpn but how? my internet was not working, so I just entered nameserver 8.8.8.8 and nameserver 8.8.4.4 in my /etc/resolv.conf file and then I didn't reload networkmanager and my internet was working but as soon as I reload networkmanager or restart my laptop, resolv.conf changes to its default and internet stopped working. So I just changed resolv.conf file and then installed protonvpn again and tried connecting it, then I got a error message that you need to disconnect other vpn service or buy premium, So that means after uninstalling it, VPN still was in act somewhere so I just closed protonvpn and ran sudo killall vpn and then systemctl restart NetworkManager and viola my internet and Gs connect were working again!!!.

I just wrote the whole scenario above so that someone with this problem doesn't get confused by complex commands answers.

Solution 3

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

Solution 4

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.

Share:
22,308

Related videos on Youtube

Daniel
Author by

Daniel

Updated on September 18, 2022

Comments

  • Daniel
    Daniel over 1 year

    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?
    • Val
      Val over 5 years
      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/…
    • HosseinAgha
      HosseinAgha over 5 years
      the @Val's solution is not working for me. It makes all VPNs to disconnection immediately.
    • Daniel
      Daniel about 4 years
      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.
  • Daniele Santi
    Daniele Santi over 5 years
    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.
  • Rob Rutten
    Rob Rutten over 4 years
    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.
  • stiv
    stiv over 4 years
    can i do the same in my ubuntu interface somehow?
  • Alex Rešatniak
    Alex Rešatniak about 4 years
    Thanks, it worked.
  • Kenjiro
    Kenjiro almost 4 years
    Thanks, it worked for as well.
  • razvang
    razvang over 3 years
    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.
  • AmirHossein Rezaei
    AmirHossein Rezaei over 3 years
    adding google dns 8.8.8.8 at the first of /etc/resolv.conf solved my problem.