DNS Issue – Fix ‘Ping 8.8.8.8 Works but Ping www.google.com Doesn’t’

dnsinternetnetworkingserver

I'm running ubuntu server 16.04.2 and apt-get update returns temporary failure resolving "everything on the list".

  • When I ping www.google.com, it responds with unknown host.
  • When I ping with 8.8.8.8, I get packets sent with no errors etc.

I have tried every "fix" I can find in Ubuntu forums and all over the
rest of the internet world and nothing works. The resolv.conf is
empty, ifconfig shows nic is functioning, firewall is off, and I
threw away the hammer just in case. Unfortunately, I am typing this
on another computer on the same network but can't attach text from the
various outputs to show whats going on. Need help on this please.

The resolv.conf file contains these lines:

# 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
search 8.8.8.8 8.8.4.4

The last line is placed their by the interfaces file when you reboot the system. This is new for 16.04LTS. I'm thinking Windows NT4 wasn't so bad and neither was Ubuntu Server 12.

Best Answer

You need a Name Server in your /etc/resolv.conf file. Edit your /etc/resolv.conf and add a working Name Server. Google provides a free one, 8.8.8.8.

Do this:

$ nano /etc/resolv.conf

Place this as the first non-commented line:

nameserver 8.8.8.8

You can verify this functionality with:

$ ping -c10 www.google.com

You can make this change permanent by adding the line to this file your /etc/resolvconf/resolv.conf.d/head file.

Related Question