LINUX

WPA on Linux

First time I tried to get WPA running I could only find 40 page long manuals enumerating innards of WPA and other stuff that was completely irrelevant to getting it running. This is the briefest setup guide I can write.

Installing WPA supplicant

GentooGentoo

# emerge wpa_supplicant

DebianDebian

# apt-get install wpasupplicant

Generating the passphrase file

In my home directory I have a 'wifi' directory where I keep my passphrase file and WPA startup script. You need to generate a file that contains your SSID and WPA passphrase; you do this with the wpa_supplicant program. The syntax is wpa_passphrase ssid passphrase

wpa_passphrase superwifi internet1234 > superwifi.wpa

Your superwifi.wpa file will contain:

network={
  ssid="superwifi"
  #psk="internet1234"
  psk=d028d7e6f9972a9930fd75992fdec8dad8d73a0f57e39608333336b0eca67b4a
}

Making a script to start your connection

This is the script that I have in my 'wifi' directory for my home network. The -D argument for wpa_supplicant tells it which driver to use. wext is the generic wireless extensions, try this first. If it doesn't work, do man wpa_supplicant and find the -D options and try the best module for your card.

 1 #!/bin/bash
 2 
 3 # Make sure root is running this or someone is using sudo
 4 if [ `whoami` != "root" ]; then
 5   echo Must be root
 6   exit 1
 7 fi
 8 
 9 # Start the association with the AP. wpa_supplicant has to be forked so that it keeps running
10 wpa_supplicant -i eth1 -c /home/mroach/wifi/superwifi.wpa -D wext &
11 
12 # Wait 3 seconds for wpa_supplicant to associate. Should be plenty
13 sleep 3
14 
15 # Ask for an IP via DHCP
16 dhclient eth1
17 
18 # Setup the DNS stuff for this network
19 echo "search home.int" > /etc/resolv.conf
20 echo "nameserver 10.84.72.3" >> /etc/resolv.conf