1 | AUTHOR: Eloi Primaux eloi AT bliscat dot org
|
---|
2 |
|
---|
3 | DATE: 2007-02-14
|
---|
4 |
|
---|
5 | LICENSE: GNU Free Documentation License Version 2
|
---|
6 |
|
---|
7 | SYNOPSIS: LFS support for wpa_supplicant managed network
|
---|
8 |
|
---|
9 | DESCRIPTION:
|
---|
10 |
|
---|
11 | ATTACHMENTS:
|
---|
12 |
|
---|
13 | http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa_service.conf
|
---|
14 | http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-rcscript
|
---|
15 | http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-service
|
---|
16 | http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-service-iface
|
---|
17 | http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa_actions-script
|
---|
18 |
|
---|
19 |
|
---|
20 | PREREQUISITES:
|
---|
21 |
|
---|
22 | - A working LFS-6.1.1 system or newer with wireless capabilities
|
---|
23 | - Almost two networks services like ipv4-static/dhcpcd installed
|
---|
24 | - wpa_supplicant (>=0.5.7) and wireless drivers
|
---|
25 |
|
---|
26 | HINT:
|
---|
27 |
|
---|
28 | 0) Requirement and Optional tools
|
---|
29 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
---|
30 |
|
---|
31 | 0.a) wpa_supplicant 'The core'
|
---|
32 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
---|
33 | This is NOT an usual step if you omit something here you won't be able to attach
|
---|
34 | your device to any access point
|
---|
35 |
|
---|
36 | Please use the 0.5.7 version or newer, available at:
|
---|
37 | link: http://hostap.epitest.fi/wpa_supplicant
|
---|
38 |
|
---|
39 | Again, i strongly recommend you to read its README before doing anything.
|
---|
40 | wpa_supplicant may need the source of your drivers then edit the .config file
|
---|
41 | as described in the README and set all constants according to your system.
|
---|
42 | also when ready install it by executing :
|
---|
43 |
|
---|
44 | find ./ -name 'Makefile' -exec sed 's,/usr/local,/usr,g' {} \ &&
|
---|
45 | make &&
|
---|
46 | make install
|
---|
47 |
|
---|
48 | 1) This Hints
|
---|
49 | ~~~~~~~~~~~~~
|
---|
50 | wpa_supplicant is designed to be a "daemon" program that runs in the background
|
---|
51 | and acts as the back-end component controlling the wireless connection.
|
---|
52 | wpa_supplicant supports separate front-end programs and a text-based
|
---|
53 | front-end (wpa_cli) is included with wpa_supplicant.
|
---|
54 |
|
---|
55 | 1.1) Install Files and Directories (this is only a proposal)
|
---|
56 |
|
---|
57 | install -d /etc/sysconfig/wpa_supplicant
|
---|
58 | install -m644 wpa_service.conf /etc/sysconfig/wpa_supplicant
|
---|
59 |
|
---|
60 | install -m755 wpa-rcscript /etc/rc.d/init.d/wpa
|
---|
61 | ln -nsf /etc/rc.d/init.d/wpa /etc/rc.d/rc3.d/S15wpa
|
---|
62 | ln -nsf /etc/rc.d/init.d/wpa /etc/rc.d/rc5.d/S15wpa
|
---|
63 | ln -nsf /etc/rc.d/init.d/wpa /etc/rc.d/rc6.d/K85wpa
|
---|
64 | ln -nsf /etc/rc.d/init.d/wpa /etc/rc.d/rc0.d/K85wpa
|
---|
65 |
|
---|
66 | install -m755 wpa_actions-script /etc/sysconfig/wpa_supplicant/wpa_actions
|
---|
67 | install -m755 ifplugd_wrapper-script /etc/sysconfig/wpa_supplicant/ifplugd_wrapper
|
---|
68 | install -m755 wpa-service /etc/sysconfig/network-devices/services
|
---|
69 |
|
---|
70 | install -d /etc/sysconfig/network-devices/ifconfig.<IFACE>
|
---|
71 | install -m644 wpa-service-iface /etc/sysconfig/network-devices/ifconfig.<IFACE>/wpa-service
|
---|
72 |
|
---|
73 | were <IFACE> is your interface
|
---|
74 |
|
---|
75 | 2) Network Configuration
|
---|
76 | ~~~~~~~~~~~~~~~~~~~~~~~~
|
---|
77 |
|
---|
78 | All configurations go in the wpa-service-iface
|
---|
79 | which is located at /etc/sysconfig/network-device/ifconfig.<IFACE>/wpa-service
|
---|
80 |
|
---|
81 |
|
---|
82 | 2.1) Network configurations with any of the three functions:
|
---|
83 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
---|
84 |
|
---|
85 | wpa-service can set up your network according to it's SSID, this means that if
|
---|
86 | the SSID "DHCP network" manage ip via a dhcp server, wpa-service will use the
|
---|
87 | SSID file descriptor to set up you network when connecting to the SSID network.
|
---|
88 |
|
---|
89 | Those ssid descriptors are named with the name of the SSID they describe,
|
---|
90 | and took place in the /etc/sysconfig/wpa_supplicant directory.
|
---|
91 |
|
---|
92 | the "AzErTy" SSID descriptor will be /etc/sysconfig/wpa_supplicant/AzeRtY
|
---|
93 |
|
---|
94 | 2.1) SSID descriptor syntax:
|
---|
95 | An SSID descriptor is a regular network configuration file as used in LFS system
|
---|
96 | it means that if SSID "IPV4" use ipv4-static, the the descriptor "IPV4" will be
|
---|
97 |
|
---|
98 | cat > /etc/sysconfig/wpa_supplicant/IPV4 << "EOF"
|
---|
99 | ONBOOT=yes
|
---|
100 | SERVICE=ipv4-static
|
---|
101 | IP=192.168.1.1
|
---|
102 | GATEWAY=192.168.1.2
|
---|
103 | PREFIX=24
|
---|
104 | BROADCAST=192.168.1.255
|
---|
105 | EOF
|
---|
106 |
|
---|
107 | and if the "DHCP" SSID use dhcp :
|
---|
108 |
|
---|
109 | cat > /etc/sysconfig/wpa_supplicant/DHCP << "EOF"
|
---|
110 | ONBOOT="yes"
|
---|
111 | SERVICE="dhcpcd"
|
---|
112 | DHCP_START="-o"
|
---|
113 | DHCP_STOP="-k -o" # the '-o' prevent your interface being destroyed by dhcpcd
|
---|
114 |
|
---|
115 | # Set PRINTIP="yes" to have the script print
|
---|
116 | # the DHCP assigned IP address
|
---|
117 | PRINTIP="no"
|
---|
118 |
|
---|
119 | # Set PRINTALL="yes" to print the DHCP assigned values for
|
---|
120 | # IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
|
---|
121 | PRINTALL="no"
|
---|
122 | EOF
|
---|
123 |
|
---|
124 | for convenience, wpa_actions fall back to /etc/sysconfig/wpa_supplicant/AUTO
|
---|
125 | when no SSID descriptor is available,
|
---|
126 |
|
---|
127 | Then install a common/automatic network configuration:
|
---|
128 | I use dhcpcd:
|
---|
129 |
|
---|
130 | cat > /etc/sysconfig/wpa_supplicant/AUTO << "EOF"
|
---|
131 | ONBOOT="yes"
|
---|
132 | SERVICE="dhcpcd"
|
---|
133 | DHCP_START="-o"
|
---|
134 | DHCP_STOP="-k -o" # the '-o' prevent your interface being destroyed by dhcpcd
|
---|
135 |
|
---|
136 | # Set PRINTIP="yes" to have the script print
|
---|
137 | # the DHCP assigned IP address
|
---|
138 | PRINTIP="no"
|
---|
139 |
|
---|
140 | # Set PRINTALL="yes" to print the DHCP assigned values for
|
---|
141 | # IP, SM, DG, and 1st NS. This requires PRINTIP="yes".
|
---|
142 | PRINTALL="no"
|
---|
143 | EOF
|
---|
144 |
|
---|
145 |
|
---|
146 |
|
---|
147 | 3) The wpa_supplicant.conf (The network keys description)
|
---|
148 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
---|
149 |
|
---|
150 | The wpa_supplicant README and wiki explain the composition of this file.
|
---|
151 |
|
---|
152 | The file syntax is the wpa_supplicant.conf file syntax, it is specific to the
|
---|
153 | wpa_supplicant program and only depend of the programmer choice, thus instead of
|
---|
154 | explaining you of how this file is read, i will show you a set of command to
|
---|
155 | create a config file with wpa_supplicant.
|
---|
156 |
|
---|
157 | in a bash shell execute:
|
---|
158 |
|
---|
159 | wpa_passphrase <ssid> [passphrase] >> wpa_supplicant.conf
|
---|
160 |
|
---|
161 | Where <ssid> is the name of the access point and where [pasphrase] is your ...
|
---|
162 | pass-phrase.
|
---|
163 |
|
---|
164 | Now edit the newly created wpa_supplicant.conf file:
|
---|
165 | Which should contains something similar to:
|
---|
166 |
|
---|
167 | network={
|
---|
168 | ssid="ssid"
|
---|
169 | #psk="passphrase"
|
---|
170 | psk=2b1d17284c5410ee5eaae7151290e9744af2182b0eb8af20dd4ebb415928f726
|
---|
171 | }
|
---|
172 |
|
---|
173 | you will directly see that you can define more than one network in this file,
|
---|
174 | that's why wpa_supplicant is very nice: it chooses automatically in its
|
---|
175 | configuration file the best (aka secure and available) network to connect.
|
---|
176 |
|
---|
177 | 4) Geting over troubles (and tunning your network)
|
---|
178 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
---|
179 |
|
---|
180 | open a new console and launch in the foreground wpa_supplicant in debug mode:
|
---|
181 |
|
---|
182 | wpa_supplicant -g/var/run/wpa_supplicant-global \
|
---|
183 | -P/var/run/wpa_supplicant.pid -ddd
|
---|
184 |
|
---|
185 | this will make wpa_supplicant to output anything to us.
|
---|
186 |
|
---|
187 | Now start the wpa_cli in another console:
|
---|
188 |
|
---|
189 | wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan[X] "" [driver] \
|
---|
190 | /var/run/wpa_supplicant
|
---|
191 |
|
---|
192 | Where wlan[X] is the device name of your network interface and where [driver] is
|
---|
193 | the name of your driver
|
---|
194 |
|
---|
195 | examples:
|
---|
196 | wpa_cli -g/var/run/wpa_supplicant-global interface_add ath0 "" madwifi \
|
---|
197 | /var/run/wpa_supplicant
|
---|
198 | wpa_cli -g/var/run/wpa_supplicant-global interface_add eth1 "" wext \
|
---|
199 | /var/run/wpa_supplicant
|
---|
200 |
|
---|
201 | if it fail, please have a look to the output of the wpa_supplicant daemon
|
---|
202 |
|
---|
203 | wpa_cli -iwlan[X] -p/var/run/wpa_supplicant
|
---|
204 |
|
---|
205 | Then in wpa_cli type :
|
---|
206 |
|
---|
207 | scan
|
---|
208 |
|
---|
209 | and after some seconds type
|
---|
210 |
|
---|
211 | scan_result
|
---|
212 |
|
---|
213 | This will output a list of available networks.
|
---|
214 |
|
---|
215 | As an example:
|
---|
216 |
|
---|
217 |
|
---|
218 | root at bliscat:/home/eloi# wpa_cli -iath0 -p/var/run/wpa_supplicant
|
---|
219 | wpa_cli v0.4.8
|
---|
220 | Copyright (c) 2004-2005, Jouni Malinen <jkmaline at cc.hut.fi> and
|
---|
221 | contributors
|
---|
222 |
|
---|
223 | This program is free software. You can distribute it and/or modify it
|
---|
224 | under the terms of the GNU General Public License version 2.
|
---|
225 |
|
---|
226 | Alternatively, this software may be distributed under the terms of the
|
---|
227 | BSD license. See README and COPYING for more details.
|
---|
228 |
|
---|
229 |
|
---|
230 | Selected interface 'ath0'
|
---|
231 |
|
---|
232 | Interactive mode
|
---|
233 |
|
---|
234 | > scan
|
---|
235 | OK
|
---|
236 | > scan_result
|
---|
237 | bssid / frequency / signal level / flags / ssid
|
---|
238 | 00:0f:b5:ee:af:8f 2437 212 [WPA2-PSK-CCMP-preauth] MY_net
|
---|
239 | 00:10:c6:eb:95:11 2457 205 [WEP] Wanadoo_5441
|
---|
240 |
|
---|
241 |
|
---|
242 | you can see that my network 'My_net' use WPA2-PSK-CCMP which is WPA-PSK
|
---|
243 | with CCMP as group and pairwise
|
---|
244 |
|
---|
245 | type exit to quit wpa_cli
|
---|
246 |
|
---|
247 |
|
---|
248 | With this output we can now feed the wpa_supplicant.conf file:
|
---|
249 |
|
---|
250 | network={
|
---|
251 | ssid="ssid"
|
---|
252 | key_mgmt=WPA-PSK
|
---|
253 | proto=WPA2
|
---|
254 | pairwise=CCMP
|
---|
255 | group=CCMP
|
---|
256 | #psk="passphrase"
|
---|
257 | psk=2b1d17284c5410ee5eaae7151290e9744af2182b0eb8af20dd4ebb415928f726
|
---|
258 | }
|
---|
259 |
|
---|
260 |
|
---|
261 | Note if you wish you can only use the human readable pass-phrase,
|
---|
262 | then comment it out and comment the hexadecimal pass-phrase
|
---|
263 |
|
---|
264 | Now kill the last instance of the wpa_supplicant daemon :
|
---|
265 |
|
---|
266 | killall wpa_supplicant
|
---|
267 |
|
---|
268 | And test your new configuration file:
|
---|
269 |
|
---|
270 | wpa_supplicant -d[driver] -iwlan[X] -c[configfile] -dd
|
---|
271 |
|
---|
272 | example:
|
---|
273 | wpa_supplicant -dmadwifi -iath0 -c./wpa_supplicant.conf -dd
|
---|
274 |
|
---|
275 | If you see something like SUCCESS it's done, kill it again and copy the config
|
---|
276 | file to a secure directory:
|
---|
277 |
|
---|
278 | install -d /etc/sysconfig/wpa_supplicant
|
---|
279 | chmod 700 -c /etc/sysconfig/wpa_supplicant
|
---|
280 | cp wpa_supplicant.conf /etc/sysconfig/wpa_supplicant/wpa_supplicant.conf
|
---|
281 | chmod 600 -c /etc/sysconfig/wpa_supplicant/wpa_supplicant.conf
|
---|
282 |
|
---|
283 |
|
---|
284 | 5) The End
|
---|
285 | ~~~~~~~~~~
|
---|
286 | execute:
|
---|
287 |
|
---|
288 | /etc/rc.d/init.d/network stop
|
---|
289 | /etc/rc.d./init.d/wpa restart
|
---|
290 | /etc/rc.d/init.d/network start
|
---|
291 |
|
---|
292 | if there is no errors, and your system is connected, then you can safely restart
|
---|
293 | your computer to see it setting up your wireless card during boot time.
|
---|
294 |
|
---|
295 | ACKNOWLEDGMENTS:
|
---|
296 | The wireless hint
|
---|
297 | The Wireless HOWTO
|
---|
298 | wpa_supplicant README
|
---|
299 | The madwifi wiki
|
---|
300 | The LFS/BLFS Books
|
---|
301 |
|
---|
302 |
|
---|
303 | CHANGELOG:
|
---|
304 | 2006 03 10 Second release, first send to lfshint
|
---|
305 | 2006 03 16 added some words to help wpa-supplicant.conf writing
|
---|
306 | 2006 03 18 fix wrong paths
|
---|
307 | 2006 03 31 Rewritten and try to match the LFS-standard thank's to archaic's help
|
---|
308 | 2006 04 01 fix incomplete find commands
|
---|
309 | 2006 10 15 wpa-service 0.2
|
---|
310 | 2006 02 14 some typo fix in scripts, removed ifplugd support, and wait_for_up function
|
---|
311 |
|
---|