I'm connecting my pi via ethernet to my router and is assigned an IP address (via static DHCP) but I'm unable to connect to any outside network. The strange thing is I can also connect via WIFI dongle and able to access outside networks:

pi@raspberrypi ~ $ ifconfig
eth0  Link encap:Ethernet  HWaddr b8:27:eb:7f:50:3d
      inet addr:  Bcast:  Mask:
      RX packets:1068 errors:0 dropped:0 overruns:0 frame:0
      TX packets:1346 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:75076 (73.3 KiB)  TX bytes:183304 (179.0 KiB)

lo    Link encap:Local Loopback
      inet addr:  Mask:
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:8 errors:0 dropped:0 overruns:0 frame:0
      TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:1104 (1.0 KiB)  TX bytes:1104 (1.0 KiB)

wlan0 Link encap:Ethernet  HWaddr 60:e3:27:0e:50:1b
      inet addr:  Bcast:  Mask:
      RX packets:918 errors:0 dropped:10 overruns:0 frame:0
      TX packets:390 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:196056 (191.4 KiB)  TX bytes:62046 (60.5 KiB)

able to ping google (presumably via wlan0):

pi@raspberrypi ~ $ ping google.com
PING google.com ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=58 time=22.2 ms
64 bytes from icmp_req=2 ttl=58 time=21.3 ms
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 21.357/21.810/22.263/0.453 ms

disable wlan0:

pi@raspberrypi ~ $ sudo ifdown wlan0

after disabling wlan0:

pi@raspberrypi ~ $ ping google.com
ping: unknown host google.com

more info:

pi@raspberrypi ~ $ more /etc/network/interfaces
auto lo

iface lo inet loopback

iface eth0 inet dhcp
#iface eth0 inet static

allow-hotplug wlan0
iface wlan0 inet dhcp

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

pi@raspberrypi ~ $ more /etc/resolv.conf

3 Answers 3


I note that both your eth0 and wlan0 are connecting to the same 192.168.2.x LAN network. I have noticed previously on other computers (such as my windows laptop) with multiple connections to the same LAN - that the LAST interface connected is the one used to send packets out. Unfortunately when this is disconnected, the computer doesn't automatically switch to the first interface.

Since the wireless generally takes longer to connect, it usually ends up being the one which is used, even though the wired interface is faster.

Try disconnecting the Ethernet cable and reconnecting it. I think you will find that now disabling wlan0 has no effect because eth0 is now the default.


I think this is how ifupdown handles the default route. You are using as nameserver and These are outside of your local network so ip request for name google.com have to follow the default route (to the internet). If you down an interface and ifupdown does not set the default route properly because there is another interface up, then your request does not find the route to the nameservers. The response is unknown host google.com.

Check the situation with command ~$ route. With it you can see the kernels current routing table. Have a look at the default route and its interface Iface. Try to ping with interface eth0 or wlan0 e.g.:

ping -I eth0 google.com

Well, it seems that the wifi dongle itself is the problem. I disconnected the dongle and the ethernet connection worked.

  • 1
    The dongle may be the problem, but then your /etc/network/interfaces has errors. If you left it the way it was it may work.
    – Milliways
    Oct 24, 2015 at 22:28
  • what is the error in my /etc/network/interfaces? Oct 25, 2015 at 19:03
  • iface wlan0 inet dhcp should be iface wlan0 inet manual if you are going to use wpa_supplicant. The fact that you use dhcp at all is also a problem, unless you have an old Raspbian and/or particularly do not want to use the current WiFi configuration.
    – Milliways
    Oct 25, 2015 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.