D-Link DWL-610 (DWL-510)

Linux configuration

Laptops are great, I got a Compaq Presario 700 and it works like a charm running Linux and all. Recently I got this really good offer from a friend of mine to buy a D-Link 713P router, which I did ofcourse. Now, having a wireless router, I had to get a wl card to my laptop. I went to the nearest computer store and grabbed the first D-Link card I saw, knowing it would probably to be pain in the ass to set up in Linux. Anyway, since I got it all working I might aswell share my experience, I bet somebody out there is doing the same mistakes I did.

Updated (2004-03-30): Added SSID and WEP security to script.
Updated (2004-02-19): Apparently the RealTek driver also works with the DWL-510 card.

  • First of all, check what version of Linux you are running, just type uname -r. I have the 2.4.20 kernel, the availible drivers are compiled for 2.4.18 and 2.4.20. My suggestion is just to go with the 2.4.20, less hassle. If you don't have it, go to www.kernel.org and download the 2.4.20 kernel.
  • Configure your kernel and add PCMCIA. You will find it under General Setup, add the PCMCIA/CardBus as a module and add CardBus support. As far as I know the DWL-610 is a CardBus type.
  • You will need the pcmcia-cs package. Read the instructions for setting it up. You won't need the modules in the package however.
  • When you have installed the pcmcia-cs package and your new kernel and modules, you should try to insert the modules. A good thing is to watch the kernel log to see what is going on, tail -f /var/log/kern.log will do the trick. Fire up another terminal window and cd to /lib/modules/2.4.20/pcmcia.

    insmod pcmcia_core.o
    insmod yenta_socket.o
    insmod ds.o

    When you inserted that last module you should see somthing like:

    kernel: cs: cb_alloc(bus 2): vendor 0x1186, device 0x3300
    kernel: PCI: Enabling device 02:00.0 (0000 -> 0003)

    Note the vendor and the device id, you will need them later.
  • Download the RTL8180L driver from the RealTek site. You will notice that there are two drivers, one for gcc v2 and the other for gcc v3. This was the tricky part, I have gcc v2.95 so naturally I downloaded the gcc v2 version. Unfortunetly, that driver is compiled for Linux 2.4.18 and that made my kernel panic. The gcc v3 version is compiled for 2.4.20 so I suggest you take that one, that's what I did.

    I'm not quite sure what exactly differs gcc 2 and 3 but I was able to link in the objectfile without any problems.
  • Unpack the driver and edit the Makefile, make sure your INCLUDEPATH is correct. You will also need to edit line 59 in r8180_pci_init.c. Remember the vendor and device id you saved from watching the kernel log, the first value is the vendor, second is device, change them accordingly. It should look something like this:

    { 0x1186, 0x3300 /*0x8139*/, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },

    Compile the driver, type make at the prompt. Now cross your fingers and do a insmod rtl8180_24x.o. This worked for me and I got the driver to load.
  • Walk around your house with your laptop, wireless is freedom!



Using DHCP

I use my wireless card with DHCP, this is a good way if you want to hook up in most places. I also only load the driver module when using the card. I placed the rtl8180_24x.o module in the /lib/modules/2.4.20/net directory.

The DHCP client I use is pump and it works just fine, there are others aswell.

I have two scripts that I use, wlanup and wlandown.

wlanup:


# Load module RealTek RTL8180L (D-Link DWL-610)
/sbin/insmod rtl8180_24x > /dev/null 2>&1

# If I use 'auto', it confuses driver about the MAC of the router
# and the driver gets the wrong BSSID, which should = router MAC
# Thx to Russell Bell
/sbin/iwpriv wlan0 wlan_para networktype=infra

# SSID as in the router
/sbin/iwpriv wlan0 wlan_para ssid=mySSID
/sbin/iwpriv wlan0 wlan_para ssid2scan=mySSID

# WEP encryption (128kbit)
# Get a unique hex key, one way to get a fairly good key is to:
# date | md5sum | cut -c 1-26
# Make sure your router has the same key
# To tight up security even more, have the router only to allow connections from certain MAC addresses.
/sbin/iwpriv wlan0 wlan_para authtype=opensystem
/sbin/iwpriv wlan0 wlan_para preamble=auto
/sbin/iwpriv wlan0 wlan_para encmode=wep
/sbin/iwpriv wlan0 wlan_para wepmode=wep104
/sbin/iwpriv wlan0 wlan_para wepdkeyid=0
/sbin/iwpriv wlan0 wlan_para wepkey104_1=d22c06e5001d3d0cc9addcd11e
/sbin/iwpriv wlan0 wlan_para basicrates=0xf
/sbin/iwpriv wlan0 wlan_para oprates=0xf

# Enable wireless LAN driver
/sbin/iwpriv wlan0 enable

# Get wlan0 IP address
/sbin/pump -i wlan0


wlandown:


# Shut down wlan0 net interface
/sbin/ifconfig wlan0 down

# Disable wireless lan driver
/sbin/iwpriv wlan0 disable

# Shutdown pump DHCP client
/sbin/pump -k

# Unload module
/sbin/rmmod rtl8180_24x




Other resources

Linux PCMCIA Information
Wireless Tools for Linux
Another story about getting Realtek8180 to work
D-Link DWL-610 (D-Link seem to have removed this product info from their site)
Max's homepage

oli(a)canit.se (47109)