Ubuntu – Ubuntu 16.04 LTS, internet connection doesn’t work, but network still can access machine

16.04internetnetworking

Last night the machine was working fine. This morning, no internet access.

I'm working with a wired Ethernet connection.
I can ping the router, but not google.
I am able to access shared files on the machine from another computer through the wired network.

Other machines on the network can access the internet. It's only the Ubuntu box that can't get internet.

I can ping google by address but not by name.

output of lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

nmcli dev show | grep DNS partial results:

IP4.DNS[1]: 192.168.0.1

Which is the router address.

`
more /etc/resolve results:

 # Generated by OpenVPN Client UP Script  

 nameserver 10.8.0.1

ls -1 /etc/resolv.conf results:

-rw-r–r– 1 root root 172 Feb 23 22:34 /etc/resolv.conf

Best Answer

It's my understanding that /etc/resolv.conf is for public nameservers only. It appears that yours has been modified to use a private nameserver ostensibly over a VPN. If you wish your Ubuntu box to obtain Domain Name Service normally to allow internet access, I suggest that you revert back to the default /etc/resolv.conf file which contains:

# 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 127.0.1.1

You can revert back to the default /etc/resolv.conf file by either restoring the original from a recent backup from before it was modified, or opening the file the link points to with the command sudo gedit /etc/resolv.conf and pasting the code from the default file above into it overwriting it's current content. You may want to save a copy of the current content beforehand as a backup somewhere you will be able to locate it if you find you need it.

NOTE: /etc/resolv.conf is a symbolic link to the file /run/resolvconf/resolv.conf so file based operations such as editing on /etc/resolv.conf will actually be carried out on /run/resolvconf/resolv.conf

To confirm that the link hasn't been erroneously modified run the command ls -l /etc/resolv.conf which should result in the output below.

lrwxrwxrwx 1 root root 29 Feb 25 2016 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

the arrow indicates it's a symlink.

For more information on resolvconf which modifies this file see the man page.

Related Question