I have a strange configuration problem with Wifi. When I connect a ethernet cable to my router, network eth0 is configured and I can access all internet resources.
However when I use a Wifi dongle, I can ssh into the Pi, but connection to the internet does not work, not even the router is reachable via ping. I have tried various combinations of settings in /etc/network/interfaces, but nothing makes it work nicely.
How can it work via eth0 and not over wlan0? Is there any option I can change to make this work better? Anything that could be misconfigured on the router? I have multiple other devices using Wifi on it without any problem...
This is the content of the config-files and output of some apps, any others that could shed some light on my problem?
$ ifconfig eth0 Link encap:Ethernet Hardware Adresse b8:27:eb:42:36:d2 UP BROADCAST MULTICAST MTU:1500 Metrik:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Lokale Schleife inet Adresse:127.0.0.1 Maske:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metrik:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) wlan0 Link encap:Ethernet Hardware Adresse 64:70:02:29:47:55 inet Adresse:192.168.1.102 Bcast:192.168.1.255 Maske:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metrik:1 RX packets:120 errors:0 dropped:125 overruns:0 frame:0 TX packets:69 errors:0 dropped:0 overruns:0 carrier:0 Kollisionen:0 Sendewarteschlangenlänge:1000 RX bytes:31342 (30.6 KiB) TX bytes:11574 (11.3 KiB)
$ iwconfig wlan0 IEEE 802.11bgn ESSID:"dodoli" Nickname:"" Mode:Managed Frequency:2.427 GHz Access Point: F4:EC:38:B5:BF:BE Bit Rate:150 Mb/s Sensitivity:0/0 Retry:off RTS thr:off Fragment thr:off Power Management:off Link Quality=100/100 Signal level=100/100 Noise level=0/100 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 lo no wireless extensions. eth0 no wireless extensions.
$ cat /etc/network/interfaces auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
$ cat /etc/resolv.conf nameserver 192.168.1.1
$ route -n Kernel-IP-Routentabelle Ziel Router Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
$ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="XXXXX" scan_ssid=1 key_mgmt=WPA-PSK psk="XXXXXXXXXXXXXXXXXXXXXXXX }
ping to 192.168.1.1 (i.e. the route) times out, however ping to my desktop machine from where I ssh into it works, but the connection is done across the router!
4 Answers 4
I found my answer here: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=31238
Basically, it suggests you try this to "see where the internet connections stops":
traceroute www.raspberrypi.org
or to check if it is the DNS that fails
traceroute 93.93.128.176
For me, the first command failed but the second succeeded, so I added this to my /etc/network/interfaces
file:
dns-nameservers 192.168.1.254 8.8.8.8
(Use your router IP instead of the first one, the second is Google's public DNS.)
Worked like a charm after a reboot.
Not sure exactly what your issue is, but I thought I would so you my settings which appear to work fine (talks to the internet happily with Ethernet, WiFi, or even both attached). The settings were taken when only the WiFi was attached.
ifconfig is basically the same
pi@raspberrypi ~ $ ifconfig
eth0 Link encap:Ethernet HWaddr b8:27:eb:cd:b8:08
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
UP LOOPBACK RUNNING MTU:16436 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
wlan0 Link encap:Ethernet HWaddr 80:1f:02:4b:76:b6
inet addr:192.168.0.202 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:655 errors:0 dropped:721 overruns:0 frame:0
TX packets:178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:91189 (89.0 KiB) TX bytes:27707 (27.0 KiB)
iwconfig is basically the same
pi@raspberrypi ~ $ iwconfig
wlan0 IEEE 802.11bg ESSID:"NomNomNom" Nickname:"<WIFI@REALTEK>"
Mode:Managed Frequency:2.427 GHz Access Point: 08:76:FF:2E:47:69
Bit Rate:54 Mb/s Sensitivity:0/0
Retry:off RTS thr:off Fragment thr:off
Power Management:off
Link Quality=97/100 Signal level=57/100 Noise level=0/100
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
lo no wireless extensions.
eth0 no wireless extensions.
/etc/network/interfaces is somewhat different for the wlan0 section. In particular it is set to manual rather than dhcp, and uses wpa-roam rather than wpa-conf.
pi@raspberrypi ~ $ cat /etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.0.198
netmask 255.255.255.0
gateway 192.168.0.1
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
/etc/resolv.conf has a couple of extra lines, not entirely sure what they do
pi@raspberrypi ~ $ cat /etc/resolv.conf
domain config
search config
nameserver 192.168.0.1
route -n is basically the same
pi@raspberrypi ~ $ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 wlan0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
/etc/wpa_supplicant/wpa_supplicant.conf only differs in the network setup, this is probably due to different WiFi setups
pi@raspberrypi ~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="NomNomNom"
psk="************************"
proto=RSN
key_mgmt=WPA-PSK
pairwise=TKIP
auth_alg=OPEN
}
Hopefully one of the differences is the problem, not entirely sure which to try though...
-
Thanks, but I think I tried every possible combination of these before, with the one from your Pi the WiFi stays unassociated and nohting I do brings it into basic connected state in the first place: $ iwconfig wlan0 unassociated Nickname:"<WIFI@REALTEK>"centic– centic2013年08月21日 20:10:58 +00:00Commented Aug 21, 2013 at 20:10
-
I have now spent a lot of time adjusting the settings this way and that way, but nothing seems to have any effect. Either Wifi does not work at all or it works, but does not do dns and access to the internet. Without a way to actually diagnose the problem I fear I must give up here...centic– centic2013年08月21日 20:20:20 +00:00Commented Aug 21, 2013 at 20:20
-
Have you changed / set any firewall settings on the Pi?PiBorg– PiBorg2013年08月22日 08:31:36 +00:00Commented Aug 22, 2013 at 8:31
-
No, didn't change the base raspberry in any other way than to set up the Wifi-Dongle. And connecting via eth0/LAN works fine.centic– centic2013年08月22日 08:48:18 +00:00Commented Aug 22, 2013 at 8:48
I was having the same issue and I replaced: auto wlan0 with: iface wlan0 inet manual
After reboot the probem was solved.
I had the same issue, ssh, vnc (remote desktop) and any communication PC --> RPI was working fine, but running sudo apt-get update or pinging any host or opening a website from the Pi did not work.
Network connection was only Wifi.
It appear that in previous runs, I had selected static IP address, however this remained in /etc/resolv.conf as manual when i reverted the change.
I also found an extra few entries related and named wlan1
My solution:
- Deleted the extra entries as i had only one dongle
- changed the wlan0 entry from manual to dhcp
hope it helps some of us
/etc/wpa_supplicant/wpa_supplicant.conf