RPisces
Posts: 6
Joined: Tue Sep 11, 2012 4:56 am

Can't get wlan working reliably

Tue Nov 20, 2012 7:10 am

I am using a Belkin N150 F6D4050 (Ralink RT4070 driver) WiFi adapter through a powered hub (with plenty of current capability - 3 amps) and no other devices connected to the hub. I've edited my network interfaces configuration file to configure the adapter for a static IP connected to a WPA2-Personal secured network and enabled hotplugging. The funny thing is, I've looked at my router's web interface and it reports that the device is connected (I'm not sure if it's associated though). If I ping it, I get no response. Take a look further down where I do fix it, but my question is regarding unnecessary user intervention to get a working connection after a reboot.

Here's my network conf file:

Code: Select all

auto lo

iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.8
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1

allow-hotplug wlan0

#iface wlan0 inet dhcp
iface wlan0 inet static
address 192.168.1.8
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.1

wpa-ssid dd-wrt
wpa-psk 123456qwerty
If I do this:

Code: Select all

pi@raspberrypi:~$ sudo ifdown eth0 ; sudo ifup wlan0
I get this:

Code: Select all

RTNETLINK answers: File exists
Failed to bring up wlan0.
This doesn't work either:

Code: Select all

pi@raspberrypi:~$ sudo ifdown eth0
ifdown: interface eth0 not configured
But this seems to work (at which point I can now connect and SSH into the Rpi):

Code: Select all

sudo ifup eth0 ; sudo ifdown eth0; sudo ifup wlan0
Why is this? Do I have to add a startup script that does this every time the Rpi boots? Isn't the kernel supposed to be able to switch between interfaces if it deems one is not connected, or do I have to additional script intelligence to do that?

Also, a side note: before and after successfully enabling wlan0, the link status from ifconfig reads the same.

I'm hoping to get this working because I want to stick this thing on a Roomba robot and get it driving around without me having to deal with connectivity problems each time I boot the damn thing! :x

Chris_777
Posts: 5
Joined: Thu Oct 04, 2012 4:47 am

Re: Can't get wlan working reliably

Thu Nov 22, 2012 8:52 pm

I have almost the same problem I am hoping someone knows the answer.

I followed this page to setup static IP
http://kerneldriver.wordpress.com/2012/ ... pberry-pi/

only difference is I log in as root and issue to get the wlan0 connected and working again.

Code: Select all

sudo ifdown wlan0  
sudo ifup wlan0
This really makes it hard to run the pi headless if I have to login and do that everytime I restart it.

As a small note DHCP worked between restarts when I first set it up. Now when I put it back to DHCP it doesn't work.

Chris

User avatar
michele.x
Posts: 72
Joined: Sat Sep 22, 2012 8:15 pm

Re: Can't get wlan working reliably

Thu Nov 22, 2012 9:09 pm

Code: Select all

# The loopback network interface
auto lo 

iface lo inet loopback

# The primary network interface
allow-hotplug wlan0 eth0
iface wlan0 inet dhcp
#        address 172.16.17.18
#        netmask 255.255.255.0
#        gateway 172.16.17.254
        dns-nameservers 172.16.17.254
        wpa-ssid goofy
        wpa-psk  MickeyMouse

iface eth0 inet dhcp

My configuration in /etc/network/interface for my raspberry is the one above
notice the allow-hotplug line with both eth0 and wlan0 lines. By the way did you ever try different wi-fi adapter on the pi?
In this case check if the file

Code: Select all

/etc/udev/rules.d/70-persistent-net.rules
exists, and if present delete it and reboot.

Chris_777
Posts: 5
Joined: Thu Oct 04, 2012 4:47 am

Re: Can't get wlan working reliably

Thu Nov 22, 2012 9:54 pm

Hey Thanks for the help

I was almost on the right track, I was following this link
http://www.tiaowiki.com/w/How_to_config ... spberry_Pi

but I didnt have the wlan0 on this line.

Code: Select all

allow-hotplug wlan0 eth0
I am using the wifi adapter from adafruit here
https://www.adafruit.com/products/814

I was making changes to interfaces and was trying to run this to restart the network stack but it was not working.

Code: Select all

sudo /etc/init.d/networking restart
it was saying my WPA supplicant was already managing wlan0 or something so I did a full restart and it works now. Also if I had auto wlan0 in there it was saying misplaced option.

In the end this is what I have that works.

Code: Select all

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

iface lo inet loopback

allow-hotplug wlan0 eth0
#auto eth0
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface wlan0 inet static
        address 192.168.0.177
        netmask 255.255.255.0
        network 192.168.0.0
        gateway 192.168.0.1
        wpa-ssid mySSID
        wpa-psk myKey

iface eth0 inet dhcp
Thank you very much for the help!
Chris

RPisces
Posts: 6
Joined: Tue Sep 11, 2012 4:56 am

Re: Can't get wlan working reliably

Fri Nov 23, 2012 1:09 am

Thanks for all the replies! I spent about another 5hrs trying to fix this damn issue, so I've re-imaged with a new Rapsbian image and connected a different WiFi adapter, which seems to have resolved the issue. I'm now using the RTL8188SU Realtek chip.

scottmizo
Posts: 1
Joined: Fri Jun 07, 2013 2:49 pm

Re: Can't get wlan working reliably

Fri Jun 07, 2013 2:56 pm

I know that this may be a little late but I have also been struggling with the same issue. I am trying to configure static IP addresses for both eth0 and wlan0. It turns out that when adding the default gateway to the second interface, you must supply a lower priority metric setting otherwise the routing will become confused. Here is my final config:

Code: Select all

auto lo

iface lo inet loopback

allow-hotplug wlan0 eth0
iface wlan0 inet static
address 192.168.0.50
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.254
wpa-passphrase passphrase
wpa-ssid ssid

#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.51
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.254
metric 100

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Hope this helps someone!

Scott

User avatar
solar3000
Posts: 1087
Joined: Sat May 18, 2013 12:14 am

Re: Can't get wlan working reliably

Fri Jun 07, 2013 5:33 pm

I'm a little late on this, but I sometimes have to
ifup --force wlan0
Antikythera

bumpusd
Posts: 2
Joined: Sat Jan 02, 2016 8:16 am

Re: Can't get wlan working reliably

Sun Jan 17, 2016 5:45 pm

This thread seems to have petered out a long time ago but since I ran across it while trying to solve my issues I thought I would mention something that I noticed for the benefit of anyone else who happens across this discussion.
When the OP gave the output from their network conf file they had both eth0 and wlan0 set to static and assigned the ip address 192.168.1.8 and I believe that is what caused the problem. I can't be sure but I bet the problem was that the wireless adapter and the ethernet adapter were armwrestling over that one ip address while the router was screaming "Stop Fighting".
Just my two bits worth on a dead thread
D

User avatar
DougieLawson
Posts: 42177
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK

Re: Can't get wlan working reliably

Sun Jan 17, 2016 8:09 pm

The whole set-up for networking has completely changed since 2013. Your problem is completely unrelated to this ancient old thread.

Start a new thread and give a proper description of your problems.
Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors - are all on my foes list.

The use of crystal balls and mind reading is prohibited.

briantw
Posts: 2
Joined: Wed Aug 28, 2013 2:26 pm

Re: Can't get wlan working reliably

Sun May 28, 2017 1:26 pm

DougieLawson wrote:Your problem is completely unrelated to this ancient old thread.
He never said he had a problem and he wasn't asking for help. If you read what he said properly, he was offering a tip for others, which I found helpful.

deleonarts
Posts: 1
Joined: Mon Jul 31, 2017 5:12 pm

Re: Can't get wlan working reliably

Mon Jul 31, 2017 5:17 pm

Thanks Scott, This worked for me as you have it below. I copied everything and replaced it with my settings and reboot. I didn't know what to put in network so I just deleted that and still worked for me.



scottmizo wrote:
Fri Jun 07, 2013 2:56 pm
I know that this may be a little late but I have also been struggling with the same issue. I am trying to configure static IP addresses for both eth0 and wlan0. It turns out that when adding the default gateway to the second interface, you must supply a lower priority metric setting otherwise the routing will become confused. Here is my final config:

Code: Select all

auto lo

iface lo inet loopback

allow-hotplug wlan0 eth0
iface wlan0 inet static
address 192.168.0.50
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.254
wpa-passphrase passphrase
wpa-ssid ssid

#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.51
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.254
metric 100

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Hope this helps someone!

Scott

Return to “Troubleshooting”