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.

4
  • Shouldn't wpa-conf /etc/wpa.conf be wpa-conf /etc/wpa_supplicant.conf to point to your wireless network settings? I just got WiFi working on raspbmc last night. When I get home today I'll test how my setup behaves across reboots. Oct 15, 2012 at 19:06
  • Opps was a typo in the question not in my settings however. /etc/network/interfaces points to the /etc/wpa_supplicant.conf
    – iiSeymour
    Oct 15, 2012 at 19:11
  • Not related to your problem, but I also suspect that iface iface lo inet loopback is also a typo, should be iface lo inet loopback. Loopback interface configuration. Oct 16, 2012 at 2:00
  • Damn my lack of proof reading skills
    – iiSeymour
    Oct 16, 2012 at 7:17

3 Answers 3

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
2
  • 1
    I've spent ages trying to get my device online. why does the google not spit this out immediately? :) thank you <3 Dec 26, 2017 at 19:54
  • If this answer does not work (I can't say for 2012, but it does not in 2019), consider replacing dhcp with manual. Mar 12, 2019 at 2:52
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

~

1
  • Darn commas had me screwed up on Debian Jessie. Does anyone know why commas seem to work on some Debian Wheezy but not Jessie? Feb 17, 2016 at 19:23
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.

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.