slitaz-doc-wiki-data view 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
line source
1 ====== Wifi, step by step =======
3 ===== Introduction =====
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.
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//.
7 Before continuing:
9 * You should know the kernel module needed by your wifi card.
10 * If you need any firmware; you should know where to download it.
12 We are going to:
14 -Install any useful software and firmware.
15 -Load the kernel module.
16 -Configure the wifi connection.
17 -Configure wpa.
18 -Get connected and surf.
19 -Shutdown wifi.
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.
23 ===== Install needed software =====
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:
27 <code>
28 # tazpkg get-install linux-wireless
29 # tazpkg get-install wireless_tools
30 # tazpkg get-install wpa_supplicant
31 </code>
33 If you need firmware:
34 <code>
35 # cd /lib/firmware
36 # wget http://www.address/of/my/firmware
37 </code>
39 Untar to install:
40 <code>
41 # tar -xvf my_firmware.tar*
42 # rm my_firmware.tar*
43 </code>
45 ===== Load the kernel module =====
47 <code>
48 # modprobe -v my_module
49 </code>
50 If you've got errors, verify that your firmware is where it should be and look at dmesg:
51 <code>
52 $ ls -l /lib/firmware
53 $ dmesg
54 </code>
55 If you don't have any errors, you can continue.
57 ===== Configure wifi interface =====
59 Before configuring a new interface, you should de-configure the old one. If your ethernet interface is configured, you should:
60 <code>
61 # ifconfig eth0 down
62 </code>
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:
65 <code>
66 # iwconfig
67 </code>
69 Now we can configure your wifi interface and start it:
70 <code>
71 # ifconfig WIFI_INTERFACE up
72 # iwconfig WIFI_INTERFACE txpower on
73 </code>
75 Let's test that the card works:
76 <code>
77 # iwlist scan
78 </code>
79 If you've got a list of access points you can now tell your wifi interface which ESSID to connect to:
80 <code>
81 # iwconfig WIFI_INTERFACE essid MY_ESSID
82 </code>
83 Iwconfig can also accept others args, look at its man page to know more.
85 ===== Configure a wep or wpa key =====
87 You can easily configure a wep key with iwconfig:
88 <code>
89 # iwconfig WIFI_INTERFACE key my_wep_key
90 </code>
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]],
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:
94 <file>
95 ap_scan=1
96 network={
97 ssid="my_essid"
98 scan_ssid=1
99 proto=WPA
100 key_mgmt=WPA-PSK
101 psk="my_clear_key"
102 priority=5
103 }
104 </file>
105 Or try:
106 <file>
107 ap_scan=1
108 network={
109 ssid="my_essid"
110 scan_ssid=1
111 key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE
112 group=CCMP TKIP WEP104 WEP40
113 pairwise=CCMP TKIP
114 psk="my_clear_key"
115 priority=5
116 }
117 </file>
118 It's now possible to launch wpa_supplicant:
119 <code>
120 # wpa_supplicant -B -w -c/etc/wpa_supplicant.conf -DWPA_DRIVER -iWIFI_INTERFACE
121 </code>
122 WPA_DRIVER is the name of the driver used by wpa_supplicant.
123 Usually, it's //wext//, but sometimes, another is needed. Here is a list of possible drivers:
125 * //wext// = Linux wireless extensions (generic, should work in most cases)
126 * //hostap// = Host AP driver (Intersil Prism2/2.5/3)
127 * //atmel// = ATMEL AT76C5XXx (USB, PCMCIA)
128 * //wired// = wpa_supplicant wired Ethernet driver
130 The option //-B// launches wpa_supplicant as a daemon. If you want to kill it:
132 <code>
133 # killall wpa_supplicant
134 </code>
136 ===== Get connected =====
138 If you want to connect in dhcp, just run:
139 <code>
140 # /sbin/udhcpc -b -i WIFI_INTERFACE -p /var/run/udhcpc.WIFI_INTERFACE.pid
141 </code>
142 Normally, you should be surfing!
144 ===== Turn off wifi =====
146 To stop wifi, you should shutdown your wifi card, and stop the wpa_supplicant and udhcpc daemons:
147 <code>
148 # iwconfig WIFI_INTERFACE txpower off
149 # kill `cat /var/run/udhcpc.WIFI_INTERFACE.pid`
150 # killall wpa_supplicant
151 </code>
152 You can also unload the kernel module:
153 <code>
154 # rmmod my_module
155 </code>
157 ----
158 \\
159 ^ Page Review Section ^^
160 |Quality| Good |
161 |Review| Minor Updates |
162 |Priority| Medium |
163 |Problems| add a [[http://forum.slitaz.org|forum post link]]|
164 |::: | OR add a [[http://labs.slitaz.org/issues |lab issue tracker link ]]|
165 |How to Improve| Suggest briefly|
166 |::: | |
168 \\
169 ----