# Can ping dns by IP, but web addresses won't resolve [solved]

## thunktone

I have found a few similar problems on the forums but no solution that works for me.

This: 

```
ping 208.67.222.222
```

 works fine.

But this: 

```
ping www.duckduckgo.com
```

 returns 'unknown host'.

The local network works fine.  I can use aliases from /etc/hosts to mount nfs partitions from my nas or ssh onto another computer.

Below are my /etc/resolv.conf, /etc/conf.d/net (showing several attempts to fix the problem) and /etc/wpa_supplicant.conf, and the outputs of ifconfig and route.

```
cat /etc/resolv.conf

# Generated by dhcpcd

# Not really generated, the following lines come from resolv.conf.head

nameserver=208.67.222.222

nameserver=208.67.220.220

nameserver=8.8.8.8

option debug
```

```
cat /etc/conf.d/net

#modules="!iwconfig !wpa_supplicant"

#modules="ifconfig"

config_NotTheNuk="192.168.42.5/24"

routes_NotTheNuk="default via 192.168.42.1"

#dns_servers_NotTheNuk="192.168.1.1"

#dns_servers_NotTheNuk="208.67.222.222 208.67.220.220"

#dns_options_NotTheNuk="timeout:5 attempts:5 rotate"

fallback_NotTheNuk="dhcp"

preferred_aps="NotTheNuk TALKTALK-85E5E4"

```

```
cat /etc/wpa_supplicant/wpa_supplicant.conf

update_config=1

ctrl_interface=/var/run/wpa_supplicant

eapol_version=1

ap_scan=1

fast_reauth=1

country=GB

##### Home network

network={

   ssid="NotTheNuk"

   psk="(correct psk)"

   priority=10

}

##### Anon's place

network={

   (irrelevant stuff)

}

```

```
ifconfig

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:16436  Metric:1

          RX packets:12 errors:0 dropped:0 overruns:0 frame:0

          TX packets:12 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:964 (964.0 B)  TX bytes:964 (964.0 B)

wlan0     Link encap:Ethernet  HWaddr 74:f0:6d:49:b1:0b  

          inet addr:192.168.42.5  Bcast:192.168.42.255  Mask:255.255.255.0

          inet6 addr: fe80::76f0:6dff:fe49:b10b/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:9113 errors:0 dropped:0 overruns:0 frame:0

          TX packets:121 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:2253063 (2.1 MiB)  TX bytes:12561 (12.2 KiB)

```

```
route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.42.0    *               255.255.255.0   U     0      0        0 wlan0

link-local      *               255.255.0.0     U     302    0        0 wlan0

loopback        localhost       255.0.0.0       UG    0      0        0 lo

default         router          0.0.0.0         UG    2002   0        0 wlan0

```

Last edited by thunktone on Mon Feb 27, 2012 2:34 pm; edited 1 time in total

----------

## papahuhn

Does "host www.duckduckgo.com 208.67.222.222" work? What do you see if you tcpdump for DNS requests and responses?

----------

## ianw1974

Your /etc/resolv.conf looks wrong to me.  You shouldn't have the = sign.  Mine looks like this:

```
nameserver 208.67.222.222

nameserver 208.67.220.220
```

mine just have a space, and not the = inbetween.  When I added the = sign on my system, it also failed to resolv DNS.  So I expect this is your problem.

----------

## thunktone

thanks guys, ianw1974's solution worked

----------

