30

I have my network setting stored in /etc/wpa_supplicant.conf and my /etc/network/interfaces looks like this:

auto lo, eth0, wlan0
iface lo inet loopback
iface eth0 inet dhcp
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant.conf

To connect to the network I have to run sudo ifconfig wlan0 up followed by sudo ifup wlan0 after every boot. Not ideal as im running raspbmc

How can I get wlan0 up and connect on boot, I have tried added the commands to /etc/rc.local but that didn't work.

iiSeymour
  • 403
  • 1
  • 4
  • 8

3 Answers3

18

I changed auto to allow-hotplug for wlan0 in my /etc/network/interfaces, see below:

pi@raspbmc:~$ cat /etc/network/interfaces
#auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

That worked for me!

I'm really not sure why this worked. The Debian documentation at this link is confusing to me because this is all new to me, however the ifquery command shown below now returns wlan0 and this command is used by /etc/init.d/networking to determine which interfaces to bring up. Previously with wlan0 as auto, ifquery --list --alow=hotplug didn't return anything.

pi@raspbmc:~$ ifquery --list --allow=hotplug
wlan0
HeatfanJohn
  • 3,115
  • 3
  • 26
  • 38
7

Your original config was ok, except for the comma's in your first line.

So use auto lo eth0 wlan0 instead...

My config:

  auto lo wlan0

  iface lo inet loopback

  iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

  iface default inet static
    address 10.0.0.81
    network 10.0.0.0
    netmask 255.255.254.0
    gateway 10.0.0.1

~

Milkmannetje
  • 171
  • 1
  • 3
1

Note to future readers: As of today, the current RPi OS is buster. If the OS you are using is not buster, you should find a more current answer as this may be outdated.

It's now March, 2021. This question was asked in Oct, 2012, and things have changed some in 8+ years! I don't know why this Q&A is being re-cycled, but I'm submitting this answer because I feel this Q&A is confusing and misleading. I won't review or comment upon the answers here beyond the obvious: they are old.

In buster the wlan0 interface should come up automatically at boot time without any intervention or configuration on your part - provided you have followed the latest instructions for setting up the wireless LAN in the official documentation.

Seamus
  • 23,558
  • 5
  • 42
  • 83