Note: The information here relates only to the old ieee80211 stack driver. If you're using Ubuntu, you will find that from Intrepid (and probably Hardy also now) there is a new driver present as standard which will do WPA(2) nicely through the standard graphical network management tools.
The r8180 module does support WPA encryption via wpa_supplicant, only you can't set it from nm-applet in Gnome. The reason is that NetworkManager can only work with wpa_supplicant using the WEXT driver (Linux Wireless Extensions v18 and higher). Unfortunately, the r8180 driver only supports WEXT up to version 16, before the WPA stuff was added. But it's not too difficult to use wpa_supplicant manually with this module, you only have to know that it needs to use the IPW driver instead of WEXT. The reason is simply that the Realtek driver was based on the Intel IPW driver code. The IPW driver itself has since been updated to do WPA properly through WEXT, but the old IPW driver for wpa_supplicant is still available and will work fine with the legacy r8180 module.
If you compiled the r8180 driver from source yourself (as you currently need to with Hardy) you may have noticed the source package includes source for wpa_supplicant. I can only assume the wpa_supplicant source was included with the driver for convenience, but in any case you don't need to use that source - the wpa_supplicant distributed with Ubuntu is more recent and it works fine with the r8180 module as follows...
First, you should kill nm-applet if it's running (that's the little network control icon you see in the top-right of a default Ubuntu desktop) because Gnome's Network Manager seems to interfere with things:
sudo pkill nm-applet
Then you'll need to create a configuration file to hold the WPA settings, which for normal WPA-PSK something like this should work:
network={
ssid="putTheNetworkNameHere"
proto=WPA
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP WEP104 WEP40
psk="putThePasswordHere"
}
Or for WPA2-PSK (i.e. RSN and CCMP):
network={
ssid="putTheNetworkNameHere"
proto=WPA2
key_mgmt=WPA-PSK
psk="putThePasswordHere"
}
Let's assume you save this as "wpa.conf", you can then just run:
sudo wpa_supplicant -Dipw -cwpa.conf -iwlan0
If all goes well, you should see some messages like this:
Linux wireless extensions version 22 detected.
ipw2x00 driver uses driver_wext (-Dwext) instead of driver_ipw.
Trying to associate with 00:13:d3:6c:ca:12 (SSID='WGDANIELS' freq=2472 MHz)
Associated with 00:13:d3:6c:ca:12
WPA: Key negotiation completed with 00:13:d3:6c:ca:12 [PTK=TKIP GTK=TKIP]
As already mentioned, the message about the ipw2x00 driver using WEXT does not apply to the r8180 module - it doesn't work with -Dwext. If you have any problems, try making sure that the relevant encryption module is loaded first e.g.
sudo modprobe ieee80211_tkip_crypt-rtl
...for TKIP, or for AES...
sudo modprobe ieee80211_ccmp_crypt-rtl
Once you have it working and associated to the AP, probably you will need to run dhclient to get an IP address:
sudo dhclient wlan0
Assuming you manage to get wpa_supplicant working like this you can avoid having to run it manually by adding the config to /etc/network/interfaces:
auto wlan0
iface wlan0 inet dhcp
wpa-driver ipw
wpa-conf /path/to/wpa.conf
After which, wpa_supplicant should get started automatically when you bring up the interface:
sudo ifup wlan0
A more complete solution is to also have the driver modules loaded and unloaded with the interface, in which case you would use something more like:
auto wlan0
iface wlan0 inet dhcp
pre-up modprobe ieee80211_crypt_rtl
pre-up modprobe ieee80211_crypt_wep_rtl
pre-up modprobe ieee80211_crypt_tkip_rtl
pre-up modprobe ieee80211_crypt_ccmp_rtl
pre-up modprobe ieee80211_rtl
pre-up modprobe r8180
wpa-driver ipw
wpa-conf /path/to/wpa.conf
post-down rmmod r8180
post-down rmmod ieee80211_rtl
post-down rmmod ieee80211_crypt_wep_rtl
post-down rmmod ieee80211_crypt_tkip_rtl
post-down rmmod ieee80211_crypt_ccmp_rtl
post-down rmmod ieee80211_crypt_rtl
Tip: You might prefer not to use a the password directly in the config file, in which case you can use wpa_passphrase to pre-compute the PSK using the SSID and the password:
$ wpa_passphrase yourSSID yourPassword
network={
ssid="yourSSID"
psk=1ab7e99d8d4b479514532b248b4066c0849de21316b3d82399eb93606cdfbd49
}
There's no compelling reason to do this for security (which still relies on the security of the file itself) only that sometimes it's better not to reveal passwords too easily in cleartext, especially if you're in the habit of reusing them.
The final thing I should mention is that if you managed to get everything working, you will probably want to disable the Network Manager applet from loading on startup, which you can do from System->Preferences->Sessions->Startup Programs by unchecking the box next to "Network Manager".





