"ping: unknown host google.com" but IPs works fine [duplicate]

I recently upgraded from Ubuntu 12.04 to Ubuntu 14.04. After restarting I have WiFi connected and/or LAN connection with no internet access. I'm using Toshiba Satellite C855D.

$ sudo lshw -C network *-network description: Wireless interface product: RTL8188CE 802.11b/g/n WiFi Adapter vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:02:00.0 logical name: wlan0 version: 01 serial: c0:d9:62:8d:39:85 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=rtl8192ce driverversion=3.13.0-24-generic firmware=N/A ip=192.168.0.109 latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn resources: irq:16 ioport:3000(size=256) memory:f0200000-f0203fff *-network description: Ethernet interface product: RTL8101E/RTL8102E PCI Express Fast Ethernet controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:06:00.0 logical name: eth0 version: 05 serial: 00:8c:fa:49:e0:4d size: 10Mbit/s capacity: 100Mbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half firmware=rtl_nic/rtl8105e-1.fw latency=0 link=no multicast=yes port=MII speed=10Mbit/s resources: irq:41 ioport:2000(size=256) memory:f0104000-f0104fff memory:f0100000-f0103fff

$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:8c:fa:49:e0:4d UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:727 errors:0 dropped:0 overruns:0 frame:0 TX packets:727 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:56993 (56.9 KB) TX bytes:56993 (56.9 KB)
wlan0 Link encap:Ethernet HWaddr c0:d9:62:8d:39:85 inet addr:192.168.0.109 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::c2d9:62ff:fe8d:3985/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1934 errors:0 dropped:0 overruns:0 frame:0 TX packets:61 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 

$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=47 time=47.2 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=47 time=44.8 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=47 time=43.6 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=47 time=156 ms 

$ ping google.com
ping: unknown host google.com

$ nslookup google.com 8.8.8.8
Server: 8.8.8.8
Address: 8.8.8.8#53
Non-authoritative answer:
Name: google.com
Address: 190.167.241.187
Name: google.com
Address: 190.167.241.178
Name: google.com
Address: 190.167.241.163
Name: google.com
Address: 190.167.241.183
Name: google.com
Address: 190.167.241.177
Name: google.com
Address: 190.167.241.172
Name: google.com
Address: 190.167.241.153
Name: google.com
Address: 190.167.241.162
Name: google.com
Address: 190.167.241.167
Name: google.com
Address: 190.167.241.152
Name: google.com
Address: 190.167.241.168
Name: google.com
Address: 190.167.241.182
Name: google.com
Address: 190.167.241.157
Name: google.com
Address: 190.167.241.173
Name: google.com
Address: 190.167.241.148
Name: google.com
Address: 190.167.241.158 

$ cat /etc/resolvconf/resolv.conf.d/head
# 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 8.8.8.8 

$ sudo service networking restart
stop: Job failed while stopping
start: Job is already running: networking 

$ nm-tool
NetworkManager Tool
State: connected (global)
- Device: eth0 ----------------------------------------------------------------- Type: Wired Driver: r8169 State: unavailable Default: no HW Address: 00:8C:FA:49:E0:4D Capabilities: Carrier Detect: yes Speed: 100 Mb/s Wired Properties Carrier: off
- Device: wlan0 [Honey Nut Cheerios] ------------------------------------------ Type: 802.11 WiFi Driver: rtl8192ce State: connected Default: yes HW Address: C0:D9:62:8D:39:85 Capabilities: Speed: 18 Mb/s Wireless Properties WEP Encryption: yes WPA Encryption: yes WPA2 Encryption: yes Wireless Access Points (* = current AP) *Honey Nut Cheerios: Infra, 00:21:29:EF:11:2D, Freq 2437 MHz, Rate 54 Mb/s, Strength 78 WPA2 Claro8AD: Infra, 00:1A:2B:B0:69:CD, Freq 2462 MHz, Rate 54 Mb/s, Strength 27 WPA2 CLAROB5F570: Infra, 88:25:2C:B5:F5:70, Freq 2412 MHz, Rate 54 Mb/s, Strength 20 WEP WIND30: Infra, 00:1F:FB:68:E3:6C, Freq 2427 MHz, Rate 54 Mb/s, Strength 37 WPA dd-wrt_vap: Infra, 02:1C:10:34:41:15, Freq 2437 MHz, Rate 54 Mb/s, Strength 24 WPA IPv4 Settings: Address: 192.168.0.109 Prefix: 24 (255.255.255.0) Gateway: 192.168.0.1 DNS: 8.8.8.8 DNS: 8.8.4.4 
7

4 Answers

I had this same problem on my upgrade from 12.04 to 14.04. The way I fixed it was by complete removal and reinstall of the resolv config. See below

sudo apt-get remove --purge resolvconf && sudo apt-get install --reinstall resolvconf

It appears that your upgrade as my did not properly install your DNS resolver.

5

Your DNS servers are not set or not working properly.

A DNS server basically translates (resolves) a domain name (like google.com) to an IP address. Without an IP address you can't connect to any website. So if a domain name can't be resolved, you can't access any website.

You can use Google's DNS servers to solve this problem:

  1. Click on the WiFi icon in the top right of your screen
  2. Click on Edit connections...
  3. Under Wi-Fi, select your network's name
  4. Click on Edit...
  5. Click on IPv4 Settings
  6. Set Additional DNS Servers to 8.8.8.8, 8.8.4.4 (note the difference between the dot and the comma)
  7. Click on Save

Try to visit Google to verify that your connection's working.

16

This is the problem. Ubuntu now by default sets 127.0.0.1 as your nameserver, placing that in your resolv.conf.

You can add a header to include your perferred name server such as google's dns by using the resolvconf header feature.

Add your preferred nameserver to your header file:

/etc/resolvconf/resolv.conf.d/head

nameserver 8.8.8.8

Be sure to place a linefeed at the end (press ENTER) after the line. Then restart your network and you should be all set.

This will place your preferred nameserver at the top of the default settings when your network starts.

You can restart your network by rebooting your computer or issue this cli:

sudo service networking restart
16

Recreate /etc/resolv.conf by running the following in Terminal (Ctrl+Alt+T) and it should fix the issue with ping:

sudo dpkg-reconfigure resolvconf

or

sudo ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf
1

You Might Also Like