CentOS4 and WPA-PSK

september 17, 2006

I got WPA-PSK working with CentOS4. I want to document this for myself, just in case I have to reinstall. Peruse these instructions if they are helpful to you. I got help from the madwifi wiki for a lot of this. This was the page I used, these instructions of mine are tailored to CentOS4. First, add the atrpms to your yum repos. Create /etc/yum.repos.d/atrpms.repo. Put inside that file:

[atrpms-stable] name=RHEL 4 $releasever - $basearch - ATrpms baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/stable gpgcheck=1 enabled=1 includepkgs=madwifi* madwifi-kmdl* madwifi-hal-kmdl* libpcsclite1 [atrpms-testing] name=RHEL 4 $releasever - $basearch - ATrpms baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/testing gpgcheck=1 enabled=1 includepkgs=wpa_supplicant wpa_supplicant-gui
By using includepkgs in the repo definition, I can make sure that nothing other than the stuff I need from atrpms gets updated when I run yum updates. Import atrpms signing key:
rpm --import http://ATrpms.net/RPM-GPG-KEY.atrpms
Change the "enabled" to 1 so that you can do the next installation (then change back to 0 if you don't want to get updates to your base install):
yum install madwifi-hal-kmdl-`uname -r` madwifi-kmdl-`uname -r` wpa_supplicant wpa_supplicant-gui
You'll have to edit /etc/modprobe.conf and add:
alias ath0 ath_pci options ath_pci autocreate=sta
Reboot. When the system comes up, you'll want to configure wpa_supplicant for your network:
/usr/sbin/wpa_passphrase YOUR_AP_SSID "YOUR_WPA_PSK_PASSPHRASE" >> /etc/wpa_supplicant/wpa_supplicant.conf
Edit /etc/wpa_supplicant/wpa_supplicant.conf and add:
key_mgmt=WPA-PSK proto=WPA
Test that your setup is working:
iwconfig ath0 essid "YOUR_AP_SSID" ifconfig ath0 SOME_IP_ADDRESS up /usr/sbin/wpa_supplicant -dd -Dmadwifi -iath0 -c /etc/wpa_supplicant/wpa_supplicant.conf
If you see:
CTRL-EVENT-CONNECTED - Connection to AP_ADDRESS completed (auth)
Then you're OK. Now, gettting things automated. First, setup your wireless card like usual in Applications -> System Settings -> Network. Then edit /etc/sysconfig/network-scripts/ifup-wireless Add to the end of that file:
/usr/sbin/wpa_supplicant -w -B -Dmadwifi -iath0 -c /etc/wpa_supplicant/wpa_supplicant.conf
Test to see that it works with:
/etc/init.d/network restart
If it does, then you're all done! This wasn't as easy as getting Ubuntu working with a WPA Wifi network, but I am glad that it works now! There wasn't much documentation on the internet for getting WPA working with RHEL and CentOS. I found the madwifi stuff by accident and it wasn't tailored to CentOS (or RHEL). Hopefully this is helpful!