Ndiswrapper and WPA in a (nut)shell

Say hello to Hactar: cheap office PC (presumably AMD Sempron and some or other chipset) gracing my parents' WPA1-encrypted network via a Siemens Gigaset 108 USB WLAN adapter. The Gigaset is supposed to have an atheros chip, but apparently madwifi cannot handle USB devices yet, so it had to be ndiswrapper. Network cards set up with ndiswrapper don't seem to show up in Yast without effort, so I did it quick n' dirty in a shell.
Note: the ndiswrapper wraps Windows drivers compliant to the Network Driver Interface Specification for use under Linux. The following HowTo is in part taken from openSuSE.

You need the packages ndiswrapper, wpa_supplicant, dhcpcd (all in SuSE distro), and the Windows driver from the installation CD (net5523.inf worked for me).
Do the following in a root shell (in whatever directory you copied the Windows drivers to):
# ndiswrapper -i net5523.inf (install)
# ndiswrapper -l (list drivers, you should get the net5523 here)
Now plug in you WLAN adapter.
# modprobe ndiswrapper
See if you find a wlan0 entry in the ouput of the following lines, note the missing configuration data in iwconfig.
# dmesg
# iwconfig
Scan for available networks:
# iwlist scan
Create a configuration file
# vi /etc/wpa_supplicant.conf
containing this (with the appropriate ESSID and PSK key):

The next lines do the actual network setup by starting the adapter, setting up the network configuration with wpa_supplicant and getting an IP with dhpcd (if you want a fixed IP, set it with ifconfig). As this is the part to do after every boot, I copied all this to a shell script.
# ifconfig wlan0 up
# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B
# dhcpcd wlan0

I suppose you can put all this in a startup script in /etc/init.d, but by this time my vacation was up.
BTW, the ndiswrapper module has to be reloaded after a kernel update with modprobe ndiswrapper. I put it also into the shell script (first line), just in case.
A nice overview over network-related shell commands can be found at Wirelessdefence.org.

No comments: