wifi client access for your raspberry
A simple but efficient tutorial on what you need to connect your Raspberry board to an Wifi acces-point
Having plug your wifi dongle and load hid driver, you probably want to use your raspberry as a router.
This article will explain you how to procede.
At first, you need to install wpa-supplicant tools
$atitude install wpa-supplicant
This program support IEEE 802.11i protocol and authentification protocols (WPA2, WPA, WEP,…)
If your distribution do not support this binary, you can download it here, and compil with this Makefile :
I use wpa-supplicant source code provided by TRENDnet (manufacturer of my wifi dongle chip):
ROOTFS= #your Rpi filesystem WIRELESS_DIR=./wireless #the directory where your install the archive CROSS_COMPILE=arm-linux-gnueabi- #the cross-compiler prefix CC=$(CROSS_COMPILE)gcc #the arm gcc to use all: extract compil install extract: @(echo "extacting wpa_supplicant archive") @(unzip $(WIRELESS_DIR)/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8_rtw_20120803.zip \ -d $(WIRELESS_DIR)/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/wpa_supplicant_hostapd/) compil: @(echo "compiliong wpa_supplicant source code") @(sed -i '1iCC=$(CC)' \ $(WIRELESS_DIR)/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/wpa_supplicant/Makefile) @(make -C $(WIRELESS_DIR)/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/wpa_supplicant_hostapd/wpa_supplicant_hostapd-0.8/wpa_supplicant ) @(test -d $(ROOTFS)/etc/wpa_supplicant || mkdir $(ROOTFS)/etc/wpa_supplicant) install: @(echo "installing wpa_supplicant in $(ROOTFS) directory") @(echo "CP wpa_supplicant") @(cp $(BIN_DIR)/wpa_supplicant/wpa_supplicant $(ROOTFS)/sbin/) @(echo "CP wpa_cli") @(cp $(BIN_DIR)/wpa_supplicant/wpa_cli $(ROOTFS)/sbin/) @(echo "CP wpa_passphrase") @(cp $(BIN_DIR)/wpa_supplicant/wpa_passphrase $(ROOTFS)/sbin/) .PHONY: extract compil install
A simple “$make all” will install wpa_supplicant, wpa_cli, and wpa_passphrase in your filesystem.
Create a /etc/wpa-supplicant.conf in order to put information needed to connect to a wifi acces-point.
$touch /etc/wpa-supplicant.conf
add this in this file :
ctrl_interface=/var/run/wpa_supplicant ap_scan=1 update_config=1 # WPA-Personal(PSK) with TKIP and enforcement for frequent PTK rekeying network={ ssid="your_ssid_name" scan_ssid=1 proto=WPA key_mgmt=WPA-PSK #psk="your_uncrypted_key" psk=your_crypted_key }
your_crypted_key is obtained with the following command
$wpa_passphrase your_ssid_name your_uncrypted_key
Now, you need to modify your general network configuration (/etc/network/interfaces file) and add this
auto wlan0 iface wlan0 inet dhcp pre-up wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf post-down killall -q wpa_supplicant
Now you have to reboot your board, or reload networking deamon :
$/etc/init.d/networking restart
Enjoy:
$iwlist wlan0
Leave a Reply
Want to join the discussion?Feel free to contribute!