Ticket #2247: wpa-service-0.21.txt

File wpa-service-0.21.txt, 9.4 KB (added by Eloi Primaux, 18 years ago)
Line 
1AUTHOR: Eloi Primaux eloi AT bliscat dot org
2
3DATE: 2007-02-14
4
5LICENSE: GNU Free Documentation License Version 2
6
7SYNOPSIS: LFS support for wpa_supplicant managed network
8
9DESCRIPTION:
10
11ATTACHMENTS:
12
13http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa_service.conf
14http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-rcscript
15http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-service
16http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa-service-iface
17http://www.linuxfromscratch.org/hints/downloads/attachments/wpa-service/wpa_actions-script
18
19
20PREREQUISITES:
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
26HINT:
27
280) Requirement and Optional tools
29~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30
310.a) wpa_supplicant 'The core'
32~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33This is NOT an usual step if you omit something here you won't be able to attach
34your device to any access point
35
36Please use the 0.5.7 version or newer, available at:
37link: http://hostap.epitest.fi/wpa_supplicant
38
39Again, i strongly recommend you to read its README before doing anything.
40wpa_supplicant may need the source of your drivers then edit the .config file
41as described in the README and set all constants according to your system.
42also when ready install it by executing :
43
44find ./ -name 'Makefile' -exec sed 's,/usr/local,/usr,g' {} \ &&
45make &&
46make install
47
481) This Hints
49~~~~~~~~~~~~~
50wpa_supplicant is designed to be a "daemon" program that runs in the background
51and acts as the back-end component controlling the wireless connection.
52wpa_supplicant supports separate front-end programs and a text-based
53front-end (wpa_cli) is included with wpa_supplicant.
54
551.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
752) Network Configuration
76~~~~~~~~~~~~~~~~~~~~~~~~
77
78All configurations go in the wpa-service-iface
79which is located at /etc/sysconfig/network-device/ifconfig.<IFACE>/wpa-service
80
81
822.1) Network configurations with any of the three functions:
83~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
84
85wpa-service can set up your network according to it's SSID, this means that if
86the SSID "DHCP network" manage ip via a dhcp server, wpa-service will use the
87SSID 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
942.1) SSID descriptor syntax:
95An SSID descriptor is a regular network configuration file as used in LFS system
96it 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
107and 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
124for convenience, wpa_actions fall back to /etc/sysconfig/wpa_supplicant/AUTO
125when no SSID descriptor is available,
126
127Then install a common/automatic network configuration:
128I 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
1473) The wpa_supplicant.conf (The network keys description)
148~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149
150The wpa_supplicant README and wiki explain the composition of this file.
151
152The file syntax is the wpa_supplicant.conf file syntax, it is specific to the
153wpa_supplicant program and only depend of the programmer choice, thus instead of
154explaining you of how this file is read, i will show you a set of command to
155create a config file with wpa_supplicant.
156
157in a bash shell execute:
158
159wpa_passphrase <ssid> [passphrase] >> wpa_supplicant.conf
160
161Where <ssid> is the name of the access point and where [pasphrase] is your ...
162pass-phrase.
163
164Now edit the newly created wpa_supplicant.conf file:
165Which should contains something similar to:
166
167network={
168 ssid="ssid"
169 #psk="passphrase"
170 psk=2b1d17284c5410ee5eaae7151290e9744af2182b0eb8af20dd4ebb415928f726
171}
172
173you will directly see that you can define more than one network in this file,
174that's why wpa_supplicant is very nice: it chooses automatically in its
175configuration file the best (aka secure and available) network to connect.
176
1774) Geting over troubles (and tunning your network)
178~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
179
180open a new console and launch in the foreground wpa_supplicant in debug mode:
181
182wpa_supplicant -g/var/run/wpa_supplicant-global \
183 -P/var/run/wpa_supplicant.pid -ddd
184
185this will make wpa_supplicant to output anything to us.
186
187Now start the wpa_cli in another console:
188
189wpa_cli -g/var/run/wpa_supplicant-global interface_add wlan[X] "" [driver] \
190 /var/run/wpa_supplicant
191
192Where wlan[X] is the device name of your network interface and where [driver] is
193the name of your driver
194
195examples:
196wpa_cli -g/var/run/wpa_supplicant-global interface_add ath0 "" madwifi \
197 /var/run/wpa_supplicant
198wpa_cli -g/var/run/wpa_supplicant-global interface_add eth1 "" wext \
199 /var/run/wpa_supplicant
200
201if it fail, please have a look to the output of the wpa_supplicant daemon
202
203wpa_cli -iwlan[X] -p/var/run/wpa_supplicant
204
205Then in wpa_cli type :
206
207scan
208
209and after some seconds type
210
211scan_result
212
213This will output a list of available networks.
214
215As an example:
216
217
218root at bliscat:/home/eloi# wpa_cli -iath0 -p/var/run/wpa_supplicant
219wpa_cli v0.4.8
220Copyright (c) 2004-2005, Jouni Malinen <jkmaline at cc.hut.fi> and
221contributors
222
223This program is free software. You can distribute it and/or modify it
224under the terms of the GNU General Public License version 2.
225
226Alternatively, this software may be distributed under the terms of the
227BSD license. See README and COPYING for more details.
228
229
230Selected interface 'ath0'
231
232Interactive mode
233
234> scan
235OK
236> scan_result
237bssid / frequency / signal level / flags / ssid
23800:0f:b5:ee:af:8f 2437 212 [WPA2-PSK-CCMP-preauth] MY_net
23900:10:c6:eb:95:11 2457 205 [WEP] Wanadoo_5441
240
241
242you can see that my network 'My_net' use WPA2-PSK-CCMP which is WPA-PSK
243with CCMP as group and pairwise
244
245type exit to quit wpa_cli
246
247
248With this output we can now feed the wpa_supplicant.conf file:
249
250network={
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
261Note if you wish you can only use the human readable pass-phrase,
262then comment it out and comment the hexadecimal pass-phrase
263
264Now kill the last instance of the wpa_supplicant daemon :
265
266killall wpa_supplicant
267
268And test your new configuration file:
269
270wpa_supplicant -d[driver] -iwlan[X] -c[configfile] -dd
271
272example:
273wpa_supplicant -dmadwifi -iath0 -c./wpa_supplicant.conf -dd
274
275If you see something like SUCCESS it's done, kill it again and copy the config
276file to a secure directory:
277
278install -d /etc/sysconfig/wpa_supplicant
279chmod 700 -c /etc/sysconfig/wpa_supplicant
280cp wpa_supplicant.conf /etc/sysconfig/wpa_supplicant/wpa_supplicant.conf
281chmod 600 -c /etc/sysconfig/wpa_supplicant/wpa_supplicant.conf
282
283
2845) The End
285~~~~~~~~~~
286execute:
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
292if there is no errors, and your system is connected, then you can safely restart
293your computer to see it setting up your wireless card during boot time.
294
295ACKNOWLEDGMENTS:
296 The wireless hint
297 The Wireless HOWTO
298 wpa_supplicant README
299 The madwifi wiki
300 The LFS/BLFS Books
301
302
303CHANGELOG:
3042006 03 10 Second release, first send to lfshint
3052006 03 16 added some words to help wpa-supplicant.conf writing
3062006 03 18 fix wrong paths
3072006 03 31 Rewritten and try to match the LFS-standard thank's to archaic's help
3082006 04 01 fix incomplete find commands
3092006 10 15 wpa-service 0.2
3102006 02 14 some typo fix in scripts, removed ifplugd support, and wait_for_up function
311