[SGVHAK] how do I give raspberry pi a permanent wifi ip on boot?

Homan Chou homanchou at gmail.com
Tue Jan 22 21:49:24 PST 2013


I just got my raspberry pi.  I don't have an extra usb keyboard and
mouse laying around so I borrowed one and quickly enabled ssh.  I want
to be able to plugin power to the raspberry pi any where in the house
(it has a realtek usb wifi) and be able to ssh into it from a known
ip.

Following this blog:
http://kerneldriver.wordpress.com/2012/10/21/configuring-wpa2-using-wpa_supplicant-on-the-raspberry-pi/
 I was able to get it working, after setting /etc/network/interfaces
to:

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

iface lo inet loopback
iface eth0 inet dhcp

#allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
iface default inet static
    address 192.168.2.33
    netmask 255.255.255.0
    gateway 192.168.2.1

and running the command:  sudo ifup wlan0

But when I reboot the pi, they wifi isn't enabled by default.  I have
to run sudo ifup wlan0 manually to activate wifi it seems.

My question is, how do I enable the wifi on boot?  I found this other
article: http://stinebaugh.info/auto-start-your-wifi-on-raspberry-pi/

Which mentions to put a bunch of stuff in /etc/rc.local ...

echo “Starting WiFi…”
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
sleep .5s
dhclient wlan0
echo “WiFi should be started”

exit 0

But is that necessary?  Or can I just put ifup wlan0 in there?  What
is your guys' approach?



More information about the HAK mailing list