altella
Posts: 62
Joined: Wed Feb 13, 2013 11:58 am
Location: Bilbao, Basque Country, Spain

WiFi connection not worknig automatically at boot up

Sat Aug 30, 2014 8:57 pm

I am using ssh with Ubuntu 14.04, and I have two static PIS in my local network at home, corresponding to my RPI, one for Ethernet and anoher one for my WiFi dongle .
If I connect with SSH using ethernet and connect the wifi, the connection is established, but when I boot the RPI, I am unable to connect through SSH or VNC with the Wifi connection. Ping commands to both IPs are responding correctly ONLY when I have theEthernet connection plugged in. If I only have the WiFi dongle, it does not respond to the Ping command

I want to be able to have the Wifi connection working from the boot automatically. My Wifi dongle is the Tp-Link TL-WN725N V2, and I have installed the driver following the instructions from here http://www.raspberrypi.org/forums/viewt ... p?p=462982 without problems

Any ideas?
Thanks in advance !!

PD: I provide more information in case is needed:

Code: Select all

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 3.12.26+ #704 PREEMPT Wed Aug 20 22:35:11 BST 2014 armv6l GNU/Linux

Code: Select all

#auto lo
auto wlan0

iface lo inet loopback
#iface eth0 inet dhcp

# config static IP LAN
auto eth0
iface eth0 inet static
address 192.168.0.99
gateway 192.168.0.1
netmask 255.255.255.0
#network 192.168.0.0
broadcast 192.168.0.255
# end config static IP LAN

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp

# config static IP WAN
iface default inet static
address 192.168.0.100
gateway 192.168.0.1
netmask 255.255.255.0
#network 192.168.0.0
broadcast 192.168.0.255
# end config static IP WAN

danjperron
Posts: 3767
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: WiFi connection not worknig automatically at boot up

Sun Aug 31, 2014 12:22 pm

Hi altella,


maybe an idea out of my mind.

Both eth0 and wlan use the same IP group ? Maybe a conflict on which port to use?

Are you using a router?

what is the status when you do

Code: Select all

sudo ifconfig
could you try to use

Code: Select all

wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
instead of wpa-roam. This is more a fix method than like the name says a roam one.

Also I don't know if that make a difference but group all de wlan lines without line space in betweens.


There is others tricks if you are using a router. You could to put the static address at the router dhcpd assignation and use dynamic at the PI.

Daniel

altella
Posts: 62
Joined: Wed Feb 13, 2013 11:58 am
Location: Bilbao, Basque Country, Spain

Re: WiFi connection not worknig automatically at boot up

Tue Sep 02, 2014 7:18 am

Hello again;

I finally managed yesterday to test the changes of the final post....
Something strange happens that I cannot understand: If I boot with the ethernet cable plugged in, Ping commands are responding to both Ethernet and Wifi connections correctly. I can also use SSH. However, when I boot with the Ethernet unplugged, the Wifi connection does not work (Host unreachable??). In this situation, if I plug Ethernet again, both connections work again.
I do not understand the problem... maybe it has to do with certain configuration in /etc/network/interfaces.
My final version is:

Code: Select all

# LOOPBACK CONNECTION
auto lo
iface lo inet loopback

# STATIC ETHERNET CONNECTION
auto eth0
iface eth0 inet static
address 192.168.0.99
gateway 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255

# STATIC WIFI CONNECTION
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.100
gateway 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface default inet dhcp
Is it necesary the last line? (iface default inet dhcp)
Any other problems?

Any clue is highly appreciated....

Cheers,

Alberto

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

Re: WiFi connection not worknig automatically at boot up

Tue Sep 02, 2014 12:08 pm

Remove "network" and "broadcast" addresses, they're just another thing to get wrong and it's easier to let Linux calculate the right value from address & netmask.

Also look at your ifplugd configuration. That stupid piece of software is designed to disable the wireless WLAN0 connection when the ETH0 connection becomes active. My solution to that is sudo apt-get purge ifplugd.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

altella
Posts: 62
Joined: Wed Feb 13, 2013 11:58 am
Location: Bilbao, Basque Country, Spain

Re: WiFi connection not worknig automatically at boot up

Wed Sep 03, 2014 9:59 am

thank you,
Today I will give it a try.
the Wlan is not deactivated, maybe just the opposite, it works only if Ethernet is plugged in.
If I remove ifplugd, the network will work as always?

Thank you,

Alberto

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

Re: WiFi connection not worknig automatically at boot up

Wed Sep 03, 2014 10:06 am

ifplugd is a tool that is designed to make your RPi / Linux run the same way that your laptop does. When you connect a wire it disables the wireless. It fiddles with the routing table so that IP packets are sent on the active interface. That's its default function.

Removing it means you have to be in complete control of your network and your routing table, if you connect a new interface you may need to change your route to your gateway.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

awair
Posts: 12
Joined: Fri Aug 29, 2014 6:36 pm

Re: WiFi connection not worknig automatically at boot up

Wed Sep 03, 2014 10:39 am

Dougie, with reference to ifplugd,

Related to my other thread, does this mean it is better (or necessary) to have (WAN) internet access on wlan0, and any (LAN) Access Point on wlan1, the second wireless adapter?

So connecting eth0 will disconnect wlan0 only, and leave wlan1 running.

Many thanks,

awair
Posts: 12
Joined: Fri Aug 29, 2014 6:36 pm

Re: WiFi connection not worknig automatically at boot up

Wed Sep 03, 2014 11:11 am

Alberto,

In response to your last post (just a newbie with respect to this, so heed accordingly), but I've read over a hundred conflicting posts on this in the last few days, so...

Always required:

Code: Select all

iface default inet dhcp
Three points from this portion:

Code: Select all

# STATIC WIFI CONNECTION
auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.0.100
gateway 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
1. 'auto wlan0' conflicts with use of wpa_supplicant
2. 'iface wlan0 inet static' needs to be 'manual' for use of wpa_supplicant
3. You can then use 'id_str' in wpa_supplicant.conf to define an interface nickname and a static IP, see below.

My suggested code would be for /etc/network/interfaces:

Code: Select all

allow-hotplug wlan0
iface wlan0 inet [b]manual[/b]
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface homewifi inet static
address 192.168.0.100
gateway 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255
...and for wpa_supplicant.conf, add one line:

Code: Select all

# WPA-Personal (PSK)
network={
    ssid="YourHomeWiFiSSID"
    psk="YourHomeWiFiSecret"
    id_str="homewifi"
If someone who knows what they're talking about could let me know if this is all complete rubbish... However, I accept that there may be other ways of dealing with the issue.

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

Re: WiFi connection not worknig automatically at boot up

Wed Sep 03, 2014 12:16 pm

DO NOT code "broadcast" or "network" in your interfaces file they aren't needed and just give you another thing to get wrong.

This config works!

/etc/network/interface

Code: Select all

auto lo
auto eth0
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
post-up iwconfig wlan0 power off
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet static
address 192.168.1.7
gateway 192.168.1.1
netmask 24
/etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
        ssid="IAINTTELLING"
        scan_ssid=1
        psk="nottellingyouthiseither"
}
network={
        ssid="spectrumfree"
        key_mgmt=NONE
        auth_alg=OPEN
}
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

altella
Posts: 62
Joined: Wed Feb 13, 2013 11:58 am
Location: Bilbao, Basque Country, Spain

Re: WiFi connection not worknig automatically at boot up

Thu Sep 04, 2014 7:21 am

Hi Dougie and awair,

Yesterday I was doing some testing.
First thing I did: sudo apt-get purge ifplugd. ;)
From my interfaces file posted in my last post, I removed "auto wlan0", and the broadcast and network entries.
With this configuration, Wifi network boots with the static IP configured if and only if the ethernet cable is plugged in. "ping" commands to both Ethernet and Wifi are working with the static IP addresses configured.
If the ethernet cable is not in its place I obtain the "host unreachable" error when I boot and I do a "ping" to the wifi connection from my host computer.

I have also tested line by line your respective configurations. For me, they do not work. The Wifi is not connecting automatically in any case, with or without Ethernet :cry:

So, summing up. Having the Ethernet cable connected does something that makes the Wifi connection work at boot up.
I am really running out of ideas, but don´t want to give in yet....

Any other test?
I sincerely appreciate your help....

Cheers,

Alberto

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

Re: WiFi connection not worknig automatically at boot up

Thu Sep 04, 2014 8:40 am

Look at your routing table.

route -n

It should look something like this.

Code: Select all

Kernel IP routing table
Destination     Gateway         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
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
The 0.0.0.0 line tells you which interface is used for traffic that isn't part of your local subnet. So in my example any IP packet destined for an address that isn't in the 192.168.1.0/24 network is routed to 192.168.1.1 (my router). The router works out (from its routing tables) how to get that packet out to the public internet.

To change it to route via eth0 I'd use
ip route del default via 192.168.1.1 dev wlan0
ip route add default via 192.168.1.1 dev eth0
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

altella
Posts: 62
Joined: Wed Feb 13, 2013 11:58 am
Location: Bilbao, Basque Country, Spain

Re: WiFi connection not worknig automatically at boot up

Thu Sep 04, 2014 10:35 am

first of all, thanks a lot Dougie. I do not know if i'll be able to solve the task, but I am learning a lot.

The thing is, I am working in my home LAN, lets say:
Desktop PC: 192.168.0.12
Ethernet Raspberry Pi: 192.168.0.99 (static configured)
WiFi Raspberry Pi: 192.168.0.100 (static configured)

So, after booting:

With Ethernet cable PLUGGED:
Ping from Desktop PC to Ethernet Raspberry Pi ---> OK !!
Ping from Desktop PC to Wifi Raspberry Pi ---> OK !!

With Ethernet cable UNPLUGGED:
Ping from Desktop PC to Ethernet Raspberry Pi ---> Nothing, obvious
Ping from Desktop PC to Wifi Raspberry Pi ---> HOST UNREACHABLE !! :shock: :shock: :shock:

Could it have to do with the routing table as you say? Anyway, i'll test it today.

thanks a lot,

Alberto

altella
Posts: 62
Joined: Wed Feb 13, 2013 11:58 am
Location: Bilbao, Basque Country, Spain

Re: WiFi connection not worknig automatically at boot up

Fri Sep 05, 2014 11:16 pm

Hello all;

Just for your interest, I have achieved some advances.
My /etc/network/interfaces is now:

Code: Select all

# LOOPBACK CONNECTION
auto lo
iface lo inet loopback

# STATIC ETHERNET CONNECTION
auto eth0
iface eth0 inet dhcp

# STATIC WIFI CONNECTION
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface AlbertoT inet static
address 192.168.0.100
gateway 192.168.0.1
netmask 255.255.255.0
And my wpa_suppplicant.conf

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="bla bla bla"
        psk="bla bla bla"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=TKIP
        auth_alg=OPEN
        id_str="AlbertoT"
}
Now, with this, I finally have my wifi booting automatically and with an static IP in my local network.
I have seen that if I plug later Ethernet, it takes the same IP than the Wifi.
Is it not possible to have two different IPs for the same raspberry Pi in the same local network?

Thank you for all,

Alberto

User avatar
eflyguy
Posts: 4
Joined: Thu Sep 04, 2014 7:14 pm
Location: Atlanta, USA

Re: WiFi connection not worknig automatically at boot up

Sat Sep 06, 2014 3:01 pm

I too have struggled with this for a couple of days (new to RPi) - I agree with earlier comments that this could be made a little simpler for first-time users. I have a pretty extensive background with unix (I'm an EE/CS in my 40's) but even following specific instructions here and elsewhere, I could not get wifi working until now.

I have found a very similar situation to posted above - the wifi would go down when I *unplugged* ethernet! I discovered, however, that with the following configuration, the device will boot with wifi active and connected.

So here's my config in case it helps others.

uname:
Linux raspberrypi 3.12.22+ #691 PREEMPT Wed Jun 18 18:29:58 BST 2014 armv6l GNU/Linux

lsusb:
Bus 001 Device 004: ID 0bda:8179 Realtek Semiconductor Corp.

Code: Select all

wget https://dl.dropboxusercontent.com/u/80256631/8188eu-20140616.tar.gz
tar -zxvf 8188eu-20140616.tar.gz
sudo install -p -m 644 8188eu.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless
sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/8188eu.ko
sudo depmod -a
/etc/network/interfaces:

Code: Select all

/etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface Octo inet static
address 10.1.1.35
gateway 10.1.1.1
netmask 255.255.255.0
/etc/wpa_supplicant/wpa_supplicant.conf:

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="my_ssid"
        psk="my_psk"
        proto=RSN
        key_mgmt=WPA-PSK
        id_str="Octo"
}
Again, this is what has worked for me after two days of struggling. Now to try and replicate this success on the OctoPi image..

User avatar
eflyguy
Posts: 4
Joined: Thu Sep 04, 2014 7:14 pm
Location: Atlanta, USA

Re: WiFi connection not worknig automatically at boot up

Sun Sep 07, 2014 12:37 am

Update - repeated the process on the OctoPi image, but used Lambra's excellent script to install the driver - worked like a charm, and first print (without attached laptop) is completed!

User avatar
eflyguy
Posts: 4
Joined: Thu Sep 04, 2014 7:14 pm
Location: Atlanta, USA

Re: WiFi connection not worknig automatically at boot up

Wed Sep 10, 2014 9:06 pm

... and after a couple of days, it quit working. Now I can't get it working again, even though I rebuilt the image from scratch. It also won't work on a model B board, either.

I did some research and this adapter was problematic for a guy who's tested several USB adapters on the three RPi models. I gave up on the TP-Link adapter. It's back at the store, and I have a Tenda W311MI adapter that (according to elinux.org) is supported without additional drivers. We'll see this evening!

User avatar
georg.bartzos
Posts: 15
Joined: Sat Aug 17, 2013 3:55 pm
Location: Germany
Contact: Website

working at boot up

Thu Sep 11, 2014 10:54 am

use wpa_passphrase

insert to /etc/network/interfaces ...

auto lo
iface lo inet loopback

iface eth0 inet dhcp

auto wlan0
iface wlan0 inet dhcp
wpa-ssid routername
wpa-psk. password (wpa_passphrase)

iface default inet dhcp

Return to “Raspberry Pi OS”