Wifi

Tutorial to setup WLAN from Bash

 * This Tutorial was taken from prupert.wordpress.com and just posted here to make sure it stays available.
 * This Tutorial was taken from prupert.wordpress.com and just posted here to make sure it stays available.

It has been tested on Linaro 12.11 and works if you know the correct settings your WLAN is using.


 * First, you need to install the relevant software. You need to have a wired connection at this point, otherwise this wont work.

sudo apt-get install wireless-tools wpasupplicant

If you are connecting to an open network, you wont need wpasupplicant. Next, you need to “bring up” (essentially this means activate) your WiFi interface. So, issue:

sudo ifconfig wlan0 up


 * Next, to make sure your wireless device is working as it should issue:

iwconfig and then sudo iwlist scan


 * This should show you some wireless networks as proof that the WiFi device is working. Also you get all relevant information required to adapt your own interfaces config. If something goes wrong here, then there is a problem with your device or driver and you need to get googling. Romans Kernels should support most of the available WLAN adapters. Roman's Kernels


 * If you are accessing a secured network and you really should be, you need to access the correct version of your WiFi key. To get your key, issue this command:

wpa_passphrase YOURSSID YOURWIFIPASSWORD


 * This will result in something that looks like this:

network={ ssid="YOURSSID" psk=fe727aa8b64ac9b3f54c72432da14faed933ea511ecab1 5bbc6c52e7522f709a } You need to make a note of the long phrase after psk= (NOT #psk=) as this your WiFi password in hex format.
 * 1) psk="YOURWIFIPASSWORD"


 * Next, you need to edit your interfaces file, so issue:

sudo nano /etc/network/interfaces


 * At the end of this file, you need to add your WiFi configuration. Here are the options you can add.

auto wlan0    #change this to the name of your WiFi interface iface wlan0 inet dhcp    #this is normally fine, if you want a static IP address replace “dhcp” with “static” netmask 255.255.255.0    #change this as appropriate for your network, this value is usually right gateway 192.168.1.1    #change this as appropriate for your network address 192.168.1.100    #only needed for a static IP address dns-nameservers 192.168.1.1    #only needed for a static IP address wpa-driver wext    #you shouldn’t need to change this wpa-ssid YOURSSID    #just type the name of your SSID here wpa-ap-scan 1    #if the name of your SSID is hidden usually, type 2 instead of 1 wpa-proto WPA   #if you use WPA1 type WPA, if you use WPA2 type RSN wpa-pairwise CCMP    #if you use AES type CCMP, if you use TKIP type TKIP wpa-group CCMP    #if you use AES type CCMP, if you use TKIP type TKIP wpa-key-mgmt WPA-PSK    #usually WPA-PSK (if you share a key) but sometimes WPA-EAP (for enterprises) wpa-psk YOURHEXKEYFROMABOVE    #the hex key that you generated earlier


 * Thus, since I am using a WiFi card that is identified as wlan0 and am connecting to a WPA1 AES encrypted network called MYPLACE that isn’t hidden without a static IP address, this is what I added:

auto wlan0 iface wlan0 inet dhcp netmask 255.255.255.0 gateway 192.168.1.1 wpa-driver wext wpa-ssid MYPLACE wpa-ap-scan 1 wpa-proto WPA wpa-pairwise CCMP wpa-group CCMP wpa-key-mgmt WPA-PSK wpa-psk 71c81a844973ae7bb1243141e5caa7b6bb0e2d7eetcetcetc


 * Here is a working config file for use with WPA2-PSK what is the default for most routers/access-points. Be aware that the 2 Network interfaces are in the same subnet, so you can either plugin WLAN OR LAN!! to use both at the same time change ones network settings.

auto lo iface lo inet loopback

auto eth0 iface eth0 inet static address 192.168.1.156 netmask 255.255.255.0 gateway 192.168.1.1 dns_nameservers 192.168.1.1

auto wlan0 iface wlan0 inet static netmask 255.255.255.0 gateway 192.168.1.1 address 192.168.1.155 dns-nameservers 192.168.1.1 wpa-driver wext wpa-ssid YOURSSID wpa-ap-scan 1 wpa-proto RSN wpa-pairwise CCMP wpa-group TKIP wpa-key-mgmt WPA-PSK wpa-psk YOURPASSPHRASEHASH

Tips and tricks
=8192cu= Workaround for dropping connection because power save.

[ 1139.170000] rtl8192c_dm_RF_Saving: RF_Normal [ 1139.170000] rtl8192c_set_FwPwrMode_cmd: Mode = 1, SmartPS = 2 [ 1139.850000] rtw_set_ps_mode: Busy Traffic, Leave 802.11 power save.. [ 1139.850000] rtl8192c_set_FwPwrMode_cmd: Mode = 0, SmartPS = 0 [ 1141.170000] rtl8192c_dm_RF_Saving: RF_Save [ 1145.170000] rtw_set_ps_mode: Enter 802.11 power save mode...

To fix the problem create a file /etc/modprobe.d/8192cu.conf with the following contents: options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

=8188eu=

Workaround for when the interface is not appearing in ifconfig etc.

if you type

lsusb

And one of the devices has the ID of obda:0179 then you can update the drivers ID with the correct one.

echo 0bda 0179 > /sys/bus/usb/drivers/rtl8188eu/new_id