Jens Krämer

Finally wireless :-)

 |  wlan, linux, debian

I just managed to get my new Netgear WG511GR PCMCIA Wlan card working with my Debian powered notebook. Was not as easy as I hoped, because there seem to be different versions of this card, and not all of them are currently supported by the driver. So it was time to learn something about ndiswrapper.

I bought this card thinking it would be supported by the driver, which is included in recent kernels. Well, it seems usually it is, but there seem to be differences depending on where the card is manufactured. During my research I found out that apparently the ones made in China (which is what I have) are unsupported at the time of this writing. The driver somehow isn’t able to reboot the card after loading the firmware.

So I gave ndiswrapper a try, which allows the use of windows wlan drivers under linux.

Make the drivers work

Install and extract ndiswrapper kernel module sources:

    apt-get install ndiswrapper-source ndiswrapper-utils
    cd /usr/src
    tar -xjf ndiswrapper-source.tar.bz2

Now go to your kernel source directory and compile the module:

    cd /usr/src/kernel-source-2.6.8
    make-kpkg modules_image

I’m not really sure if you have to have the kernel sources installed for compiling the module, maybe there’s a way to compile the module without them ? Now install the resulting debian package containing the ndiswrapper kernel module (as root)

    dpkg -i /usr/src/ndiswrapper-modules-2.6.8_i386.deb

Now install the Windows drivers for ndiswrapper to use. This is explained in the INSTALL file located in /usr/src/modules/ndiswrapper, so I won’t duplicate this information here. To prevent hotplug from loading the prism54 driver when inserting the card, create a file containing the module name in /etc/hotplug/blacklist.d:

    echo prism54 > /etc/hotplug/blacklist.d/prism54

Don’t forget to load the ndiswrapper module using modprobe ndiswrapper before inserting the PCMCIA card. It is working if you see something like this in the syslog after inserting the card:

    wlan0: ndiswrapper ethernet device 00:0f:b5:24:ae:b2 using driver netwg511
    wlan0: encryption modes supported: WEP, WPA with TKIP, AES/CCMP

iwconfig should now show your card as device wlan0.

Network and encryption config

Now it’s time to set up the network interface by editing /etc/network/interfaces:

# Bring up hot plugged interfaces with logical interface name # the same as their physical interface name mapping hotplug script echo # Change the ip and network addresses to suit your needs # or just use dhcp: auto wlan0 iface wlan0 inet static address netmask network broadcast gateway # wireless specific configuration wireless_mode managed wireless_rate 54M auto # Channel can be between 1..14, I suppose wireless_channel 9 # Start wpa_supplicant before bringing up the interface, but only if not already running pre-up wpa_cli -i $IFACE status > /dev/null 2>&1 || wpa_supplicant -i $IFACE -D ndiswrapper -c /etc/wpa_supplicant.conf -wB # Kill wpa_supplicant when bringing down the interface post-down pkill -f "^wpa_supplicant -i $IFACE" || true

Now create the file /etc/wpa_supplicant.conf. The settings made there should correspond to those made on your access point. You can create this file using the following command:

    wpa_passphrase your_essid your_passphrase > /etc/wpa_supplicant.conf

Now you should be able to bring up/down the interface using ifup/down wlan0. On insert/remove the interface should be brought up/down automatically through hotplug.