minor changes
[martlubbers.net.git] / archive / wlan-debian.html
1 <html>
2 <head>
3 <title>Automatic wifi without heavy network manager on debian</title>
4 <link href="style.css" rel="stylesheet" type="text/css">
5 </head>
6 <body>
7 <h3>PREREQUISITES</h3>
8 <p>Install wpa_supplicant and wireless-tools(standard in most distros).<br />
9 <pre># apt-get install wireless-tools wpa_supplicant</pre>
10 <br />
11 Identify your wifi controller. This can usually be found by typing<br />
12 <pre>$ iwconfig</pre>
13 <br />
14 Locate all the config files for your desired networks. Mine are placed in /etc/network/wifi/<SSID>.conf. More info on creating configs in the end of the file.</p>
15
16 <h3>INSTALLATION</h3>
17 <p>Create the SSID selection script.<br />
18 I've put mine in /etc/network/wifi/select<br />
19 <pre>
20 #!/bin/sh
21 ifconfig [INTERFACE] up 1> /dev/null && { iwlist [INTERFACE] scan | grep -o "\".*\"" | tr -d \'\" | sort | uniq; grep -o "map\ .*" /etc/network/interfaces | awk '{print $2}'; } | sort | uniq -d | head -1
22 </pre>
23 <br />
24 Make it executable.<br />
25 <pre># chmod +x /etc/network/wifi/select</pre>
26 <br />
27 Change in /etc/network/interfaces the [INTERFACE] specification.<br />
28 <pre>
29 mapping [INTERFACE]
30 script /etc/network/wifi/select
31 map [SSID]1
32 map [SSID]2
33 ..
34 map eduroam
35
36 iface [SSID]1 inet dhcp
37 wpa_conf /etc/network/wifi/[SSID]1.conf
38
39 iface [SSID]2 inet dhcp
40 wpa_conf /etc/network/wifi/[SSID]2.conf
41
42 ..
43
44 iface eduroam inet dhcp
45 wpa_conf /etc/network/wifi/eduroam.conf
46 </pre>
47 <br />
48 You're finished! Restart the network service with:<br />
49 <pre># service networking restartworking restart</pre>
50 And you can connect to a available network by running this command.<br />
51 <pre># ifup [INTERFACE]</pre>
52 If you want to force an [SSID] you can run:<br />
53 <pre># ifup [INTERFACE]=[SSID]</pre></p>
54
55 <h3>CONFIG CREATION</h3>
56 <p>Standard wpa2 network configs can be created by running:<br />
57 <pre># wpa_passphrase [SSID] [PASSWORD] > /etc/network/wifi/[SSID].conf</pre>
58 <br />
59 For eduroam you can use this example:<br />
60 <pre>
61 network={
62 ssid="eduroam"
63 key_mgmt=WPA-EAP
64 eap=TTLS
65 phase2="auth=MSCHAPV2"
66 ca_cert="/etc/ssl/certs/AddTrust_External_Root.pem"
67 identity="login@university.nl"
68 scan_ssid=1
69 password="YOURPASSWORD"
70 }
71 </pre>
72 If you don't want your password in a config you can also use a hash generated by this command. (Don't forget to remove it from ~/.bash_history afterwards)<br />
73 <pre>$ echo -n [PASSWORD] | iconv -t UTF16LE | openssl md4</pre>
74 You should replace the plaintext string with: "hash:[HASHOUTPUT]"<br />
75 note: don't use quotes.</p>
76 <footer>update 2014-03-04: fixed a few small errors concerning hashing and config files</footer>
77 </body>
78 </html>