slitaz-doc-wiki-data annotate pages/en/guides/wifi-hard.txt @ rev 7

Add pages/en folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Sat Feb 26 12:17:18 2011 +0000 (2011-02-26)
parents
children
rev   line source
slaxemulator@7 1 ====== Wifi, step by step =======
slaxemulator@7 2
slaxemulator@7 3 ===== Introduction =====
slaxemulator@7 4
slaxemulator@7 5 If you want to use your wifi right away, this page is not for you. You should look at the easy wifi tutorial which explains how to use the tools given by SliTaz.
slaxemulator@7 6 But if you want to know how to use wifi (under linux), this page will explain how, and help you to configure it //from scratch//.
slaxemulator@7 7 Before continuing:
slaxemulator@7 8
slaxemulator@7 9 * You should know the kernel module needed by your wifi card.
slaxemulator@7 10 * If you need any firmware; you should know where to download it.
slaxemulator@7 11
slaxemulator@7 12 We are going to:
slaxemulator@7 13
slaxemulator@7 14 -Install any useful software and firmware.
slaxemulator@7 15 -Load the kernel module.
slaxemulator@7 16 -Configure the wifi connection.
slaxemulator@7 17 -Configure wpa.
slaxemulator@7 18 -Get connected and surf.
slaxemulator@7 19 -Shutdown wifi.
slaxemulator@7 20
slaxemulator@7 21 //PS:// On SliTaz, the script /usr/bin/get-wifi-firmware takes care of steps 1 and 2, and the script /etc/init.d/network.sh; steps 3 to 6.
slaxemulator@7 22
slaxemulator@7 23 ===== Install needed software =====
slaxemulator@7 24
slaxemulator@7 25 You'll need the wifi kernel modules and some software to manage wifi. If you are using a wpa key, you'll also need wpa_supplicant:
slaxemulator@7 26
slaxemulator@7 27 <code>
slaxemulator@7 28 # tazpkg get-install linux-wireless
slaxemulator@7 29 # tazpkg get-install wireless_tools
slaxemulator@7 30 # tazpkg get-install wpa_supplicant
slaxemulator@7 31 </code>
slaxemulator@7 32
slaxemulator@7 33 If you need firmware:
slaxemulator@7 34 <code>
slaxemulator@7 35 # cd /lib/firmware
slaxemulator@7 36 # wget http://www.address/of/my/firmware
slaxemulator@7 37 </code>
slaxemulator@7 38
slaxemulator@7 39 Untar to install:
slaxemulator@7 40 <code>
slaxemulator@7 41 # tar -xvf my_firmware.tar*
slaxemulator@7 42 # rm my_firmware.tar*
slaxemulator@7 43 </code>
slaxemulator@7 44
slaxemulator@7 45 ===== Load the kernel module =====
slaxemulator@7 46
slaxemulator@7 47 <code>
slaxemulator@7 48 # modprobe -v my_module
slaxemulator@7 49 </code>
slaxemulator@7 50 If you've got errors, verify that your firmware is where it should be and look at dmesg:
slaxemulator@7 51 <code>
slaxemulator@7 52 $ ls -l /lib/firmware
slaxemulator@7 53 $ dmesg
slaxemulator@7 54 </code>
slaxemulator@7 55 If you don't have any errors, you can continue.
slaxemulator@7 56
slaxemulator@7 57 ===== Configure wifi interface =====
slaxemulator@7 58
slaxemulator@7 59 Before configuring a new interface, you should de-configure the old one. If your ethernet interface is configured, you should:
slaxemulator@7 60 <code>
slaxemulator@7 61 # ifconfig eth0 down
slaxemulator@7 62 </code>
slaxemulator@7 63
slaxemulator@7 64 iwconfig allows you to configure your wifi card, so that it can connect to your access point. You need to know the name of your wifi interface (usually //wlan0// or //eth1//). If you don't know its name, just run iwconfig:
slaxemulator@7 65 <code>
slaxemulator@7 66 # iwconfig
slaxemulator@7 67 </code>
slaxemulator@7 68
slaxemulator@7 69 Now we can configure your wifi interface and start it:
slaxemulator@7 70 <code>
slaxemulator@7 71 # ifconfig WIFI_INTERFACE up
slaxemulator@7 72 # iwconfig WIFI_INTERFACE txpower on
slaxemulator@7 73 </code>
slaxemulator@7 74
slaxemulator@7 75 Let's test that the card works:
slaxemulator@7 76 <code>
slaxemulator@7 77 # iwlist scan
slaxemulator@7 78 </code>
slaxemulator@7 79 If you've got a list of access points you can now tell your wifi interface which ESSID to connect to:
slaxemulator@7 80 <code>
slaxemulator@7 81 # iwconfig WIFI_INTERFACE essid MY_ESSID
slaxemulator@7 82 </code>
slaxemulator@7 83 Iwconfig can also accept others args, look at its man page to know more.
slaxemulator@7 84
slaxemulator@7 85 ===== Configure a wep or wpa key =====
slaxemulator@7 86
slaxemulator@7 87 You can easily configure a wep key with iwconfig:
slaxemulator@7 88 <code>
slaxemulator@7 89 # iwconfig WIFI_INTERFACE key my_wep_key
slaxemulator@7 90 </code>
slaxemulator@7 91
slaxemulator@7 92 But you should //always// use a wpa key, because wep keys can be easily cracked with aircrack, as noted [[http://www.tuto-fr.com/tutoriaux/tutorial-crack-wep-aircrack.php|here]],
slaxemulator@7 93 wpa_supplicant allows you to use a wpa key (some cards may use wpa without wpa_supplicant). It needs a config file. Usually, ///etc/wpa_supplicant.conf//. If you are using wpa_psk (normally, you are), add this to the file:
slaxemulator@7 94 <file>
slaxemulator@7 95 ap_scan=1
slaxemulator@7 96 network={
slaxemulator@7 97 ssid="my_essid"
slaxemulator@7 98 scan_ssid=1
slaxemulator@7 99 proto=WPA
slaxemulator@7 100 key_mgmt=WPA-PSK
slaxemulator@7 101 psk="my_clear_key"
slaxemulator@7 102 priority=5
slaxemulator@7 103 }
slaxemulator@7 104 </file>
slaxemulator@7 105 Or try:
slaxemulator@7 106 <file>
slaxemulator@7 107 ap_scan=1
slaxemulator@7 108 network={
slaxemulator@7 109 ssid="my_essid"
slaxemulator@7 110 scan_ssid=1
slaxemulator@7 111 key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
slaxemulator@7 112 group=CCMP TKIP WEP104 WEP40
slaxemulator@7 113 pairwise=CCMP TKIP
slaxemulator@7 114 psk="my_clear_key"
slaxemulator@7 115 priority=5
slaxemulator@7 116 }
slaxemulator@7 117 </file>
slaxemulator@7 118 It's now possible to launch wpa_supplicant:
slaxemulator@7 119 <code>
slaxemulator@7 120 # wpa_supplicant -B -w -c/etc/wpa_supplicant.conf -DWPA_DRIVER -iWIFI_INTERFACE
slaxemulator@7 121 </code>
slaxemulator@7 122 WPA_DRIVER is the name of the driver used by wpa_supplicant.
slaxemulator@7 123 Usually, it's //wext//, but sometimes, another is needed. Here is a list of possible drivers:
slaxemulator@7 124
slaxemulator@7 125 * //wext// = Linux wireless extensions (generic, should work in most cases)
slaxemulator@7 126 * //hostap// = Host AP driver (Intersil Prism2/2.5/3)
slaxemulator@7 127 * //atmel// = ATMEL AT76C5XXx (USB, PCMCIA)
slaxemulator@7 128 * //wired// = wpa_supplicant wired Ethernet driver
slaxemulator@7 129
slaxemulator@7 130 The option //-B// launches wpa_supplicant as a daemon. If you want to kill it:
slaxemulator@7 131
slaxemulator@7 132 <code>
slaxemulator@7 133 # killall wpa_supplicant
slaxemulator@7 134 </code>
slaxemulator@7 135
slaxemulator@7 136 ===== Get connected =====
slaxemulator@7 137
slaxemulator@7 138 If you want to connect in dhcp, just run:
slaxemulator@7 139 <code>
slaxemulator@7 140 # /sbin/udhcpc -b -i WIFI_INTERFACE -p /var/run/udhcpc.WIFI_INTERFACE.pid
slaxemulator@7 141 </code>
slaxemulator@7 142 Normally, you should be surfing!
slaxemulator@7 143
slaxemulator@7 144 ===== Turn off wifi =====
slaxemulator@7 145
slaxemulator@7 146 To stop wifi, you should shutdown your wifi card, and stop the wpa_supplicant and udhcpc daemons:
slaxemulator@7 147 <code>
slaxemulator@7 148 # iwconfig WIFI_INTERFACE txpower off
slaxemulator@7 149 # kill `cat /var/run/udhcpc.WIFI_INTERFACE.pid`
slaxemulator@7 150 # killall wpa_supplicant
slaxemulator@7 151 </code>
slaxemulator@7 152 You can also unload the kernel module:
slaxemulator@7 153 <code>
slaxemulator@7 154 # rmmod my_module
slaxemulator@7 155 </code>
slaxemulator@7 156
slaxemulator@7 157 ----
slaxemulator@7 158 \\
slaxemulator@7 159 ^ Page Review Section ^^
slaxemulator@7 160 |Quality| Good |
slaxemulator@7 161 |Review| Minor Updates |
slaxemulator@7 162 |Priority| Medium |
slaxemulator@7 163 |Problems| add a [[http://forum.slitaz.org|forum post link]]|
slaxemulator@7 164 |::: | OR add a [[http://labs.slitaz.org/issues |lab issue tracker link ]]|
slaxemulator@7 165 |How to Improve| Suggest briefly|
slaxemulator@7 166 |::: | |
slaxemulator@7 167
slaxemulator@7 168 \\
slaxemulator@7 169 ----