Sunteți pe pagina 1din 11

Setting up a WiFi connection on the

RaspberryPi

Ive recently tried to setup a WiFi connection with the RaspberryPi and encountered some issues:
the connection didnt start automatically and it wasnt stable. Im using an Edimax EW-7811Un
USB dongle, which is supposed to be supported out of the box with Raspian Wheezy (2012-12-
16).
After researching the issue, I finally have a configuration that works reliably. Here are the steps
Ive followed.
Setting up the configuration
Edit the /etc/network/interfaces file to look like this:
auto lo

iface lo inet loopback
iface eth0 inet dhcp

#auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Then add your WiFi parameters to /etc/wpa_supplicant/wpa_supplicant.conf.
Here are my parameters to connect to my freebox (French ISP router).
network={
ssid="YOURSSID"
scan_ssid=1
key_mgmt=WPA-PSK
proto=WPA
psk="YOURPASSWORD"
}
At this point, the you should be able to start the connection with this command:
sudo ifup wlan0
In some cases, you might need to do sudo ifup wlan0 first.
Connect automatically when booting
To make the connection work when the RaspberryPi boots, I have added a few lines
to /etc/rc.local (source) :
echo "Starting WiFi..."
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
sleep .5s
dhclient wlan0
echo "WiFi should be started"

exit 0
Keep the connection alive
To make sure that the connection stays up, Ive done two things.
First, disable the power management of the WiFi dongle. Create a
new /etc/modprobe.d/8192cu.conf file with this content (source):
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
Then, make the RaspberryPi ping the router every minute. Open your crontab:
$ crontab -e
and add this line at the end :
*/1 * * * * ping -c 1 192.168.0.254
Replace the IP address by the actual IP address of your router.
It took me some time to get it right, but now the Pi connection seems to work


How to setup a USB wlan connection on a Raspberry Pi
alternative method
1 Reply
Last week I received a new Raspberry PI model B with 512MB ram. I tried to enable WLAN using my own
instructions for the Edimax WLAN Hi-Speed USB 2.0 EW-7811Un Nano and it didnt work!?!? Huh?
Some how I got the following error message:
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
but after some google-ing I found a solution for the problem. In many posts on the web, it is suggested that the
problem relates to a lack of power issue on the RPi USB. I found out that it is really a configuration issue.
Here is how I solved it:
The setup assumes working from a clean Rasbian Wheezy image and applying the latest updates.
Configure the network adapter interface
sudo nano /etc/network/interfaces
you have to make the content of /etc/network/interfaces look like this:
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid YOUR NETWORK SSID HERE
wpa-psk YOUR NETWORK PASWORD HERE
ctrl-x and Y to save the changes
Now just restart your network connections
sudo /etc/init.d/networking restart
or alternatively reboot
sudo reboot
That is it! You dont have to use the /etc/wpa_supplicant/wpa_supplicant.conf with this setup.

This entry was posted in Raspberry, Wlan and Wifi and tagged Edimax, Edimax ew-7811un, Raspberry
Pi, Rpi, USB, Wireless LAN, Wlan, wpa supplicant,wpa_supplicant: /sbin/wpa_supplicant daemon failed to
start on April 1, 2013.
How to setup a USB wlan connection on a Raspberry Pi
2 Replies
A little while ago I got myself a Raspberry Pi to tinker around. I didnt know anything about Linux / Debian /
Wheezy but I was inspired by the many different kind of applications of the Raspberry Pi that I read about on
the internet.
In the meantime Ive managed to turn the Raspberry into an Airpi. It took me some time to figure everything
out, but I finally got there.
Every time I want to change/add some functionality I find myself spending lots of time Google-ing for the
right solution. The solutions that work Ill share on this blog so you can save some time achieving the same.
Today I figured out how to setup and enable the USB wlan connection on the Raspberry Pi and make it
connect to my wireless network.
update, Ive also posted an alternative solution: How to setup a USB wlan connection on a Raspberry Pi
alternative method
I got two usb wlan adapters which I both tested and seemed to work with this method:
Edimax WLAN Hi-Speed USB 2.0 EW-7811Un Nano
WLAN 11n USB Micro Stick US300EX Lite
First you need to configure the network adapter interface
sudo nano /etc/network/interfaces
#-
# This file describes the network interfaces available on your system
# and how to activate them.
# The loopback network interface
auto lo
iface lo inet loopback
# the LAN network interface
auto eth0
iface eth0 inet dhcp
# the WLAN network interface
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
#-
Then you need to set the wlan parameters
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
#-
network={
ssid=put your SSID here
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP
auth_alg=OPEN
psk=put your psk here
}
#-
Then you need to reboot
sudo reboot




Konfigurasi koneksi Wireless WEP
dan WPA pada Raspberry Pi
Diposkan oleh Rizky Rusfadilah di Wednesday, April 17, 2013

Di tulisan sebelumnya telah saya bahas mengenai instalasi USB WiFi Adapter menggunakan
Edimax EW-7811Un . Agar Pi dapat terhubung ke jaringan atau internet diperlukan konfigurasi.

Konfigurasi yang akan saya sampaikan bersifat umum dan dapat digunakan oleh perangkat lain
selain Edimax EW-7811Un. Konfigurasi Wireless akan saya jelaskan untuk 2 model yaitu yang
menggunakan:

WEP
WPA
Kedua konfigurasi diatas umumnya sering digunakan pada setiap wireless router. Mengingat dari
tulisan sebelumnya Wifi adapter yang terdaftar pada Pi saya adalah wlan0, maka setiap konfigurasi
yang dilakukan menggunakan wlan0.


1. Konfigurasi WEP pada Raspberry Pi
WEP dapat dikatakan sudah terlalu tua untuk sistem keamanan wireless namun masih banyak
digunakan, karena banyak perangkat lama (laptop, PC) yang hanya memiliki kemampuan tersebut
dan tidak dapat ditingkatkan ke WPA.

Agar Pi dapat menggunakan WEP, buka text editor dan buka file etc/network/interfaces
Dengan perintah: sudo nano etc/network/interfaces

Lalu tambahkan baris wireless berikut:
?
1
2
3
4
5
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid "SSID_MU"
wireless-key "WEP_KEY_MU"

Ganti kata SSID_MU dengan nama koneksi Wifi yang kamu gunakan tanpa tanda kutip.
Ganti kata WEP_Key_MU dengan password Wifi yang kamu gunakan tanpa tanda kutip.

Dengan konfigurasi diatas maka, Pi akan mendapatkan ip dinamis dari Wireless Router.
Untuk memastikan apakah konfigurasi sudah tepat, matikan service wireless Pi dengan
perintah: sudo ifdown wlan0

Dan aktifkan kembali dengan perintah: sudo ifup wlan0

Untuk mengetahui apakah sudah mendapatkan ip, ketik: ifconfig -a



Akan tampil informasi jaringan wireless beserta ip yang digunakan.

2. Konfigurasi WPA pada Raspberry Pi
Konfigurasi WPA tidak jauh berbeda dengan WEP hanya ada beberapa kata yang harus diganti
pada fileetc/network/interfaces
Ketik perintah: sudo nano etc/network/interfaces

Lalu tambahkan baris berikut:
?
1
2
3
4
5
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "SSID_MU"
wpa-psk "WPA_KEY_MU"

Ganti kata SSID_MU dengan nama koneksi Wifi yang kamu gunakan tanpa tanda kutip.
Ganti kata WPA_Key_MU dengan password Wifi yang kamu gunakan tanpa tanda kutip.

Untuk memastikan apakah konfigurasi sudah tepat, matikan service wireless Pi dengan
perintah: sudo ifdown wlan0

Dan nyalakan kembali dengan perintah: sudo ifup wlan0

Untuk mengetahui apakah sudah mendapatkan ip, ketik: ifconfig -a



Akan tampil informasi jaringan wireless beserta ip yang digunakan.

Yup.. Mudah bukan konfigurasi wireless di Raspberry Pi :)

Referensi Tulisan:
http://jeffskinnerbox.wordpress.com
http://wiki.debian.org/WiFi/HowToUse

S-ar putea să vă placă și