Linux install and configure DLink DWL g 520 – RT61 Wireless LAN PCI Card

Posted on in Categories Debian Linux, Howto, Wireless networking last updated June 12, 2007

The D-Link AirPlusXtremeG DWL-G520 Wireless PCI card is an enhanced 802.11g high-performance, wireless card for desktop computers. It supports high-speed wireless networking of up to 108Mbps.

This card has open source GPL driver. Card comes with RT61 chipset from ralinktech. You need to compile this driver for Linux. Make sure you have gcc compiler installed.

My setup is as follows:

  • Linksys WRT54G Wireless router/802.11g access point at 192.168.1.1
  • ADSL Router at 192.168.1.254
  • My Laptop IP 192.168.1.100 (obtained using WRT54G DHCP server)
  • My Desktop system (Static IP 192.168.1.2)
  • Other devices (Mobile, PDA, XBOX 360 etc)
  • Debian Linux

DLINK DWL g520 PCI Wireless card

Step #1: Verify your driver chipset with lspci command

$ lspci

Output:

....
..
0000:01:00.0 Network controller: RaLink RT2561/RT61 rev B 802.11
...
..

Use update-pciids command to fetch the current version of the pci.ids file from the primary distribution site and installs it.
# update-pciids
$ lspci

Step #2: Find out your kernel version ( I am using kernel v2.6)

# uname -r

Output:

2.6.15.4

Step #3: Download driver

Visit ralinktech site to download RT61 chipset driver.

# cd /opt
# wget http://www.ralinktech.com.tw/data/RT61_Linux_STA_Drv1.1.0.0.tar.gz

Step #4: Untar driver, type the following command

# tar -zxvf RT61_Linux_STA_Drv1.0.4.0.tar.gz
# cd RT61_Linux_STA_Drv1.0.4.0.tar.gz

Step #5: Compile driver source code

# cd Module
# cp Makefile.6 Makefile
# make

It will take some time to compile driver source code.

Step #6: Install driver

You need to copy firmware and configuration file to /etc/Wireless/RT61STA/ directory. First, create a directory:

# mkdir -p /etc/Wireless/RT61STA

Now copy binary firmware files:

# cp rt2561.bin /etc/Wireless/RT61STA/
# cp rt2561s.bin /etc/Wireless/RT61STA/
# cp rt2661.bin /etc/Wireless/RT61STA/

Now copy confiugration file:

# cp rt61sta.dat /etc/Wireless/RT61STA/rt61sta.dat
# dos2unix /etc/Wireless/RT61STA/rt61sta.dat

Now copy actual driver (rt61.ko) to your kernel directory:

# cp rt61.ko /lib/modules/$(uname -r)/kernel/drivers/net/wireless

Step #7: Configure card

Next logical step is to load the device driver. If you have Ethernet card disable to avoid problems:

# ifconfig eth0 down
# modprobe rt61

Once driver is loaded, you can activate interface called ra0. With ifconfig command:

# ifconfig ra0 192.168.1.2 up

To configure a wireless network interface you need to use iwconfig command. This command is part of wireless-tools package. If wireless-tools is not installed use apt-get or yum to install it:

# apt-get install wireless-tools

Now make sure you know the ssid / essid. If you have turned on encryption, you must use the same encryption type and key on both desktop system and the wireless router. You can obtain necessary settings using iwlist command:

# iwlist ra0 scanning

Output:

ra0       Scan completed :
           Cell 01 - Address: 00:12:39:6C:D6:8A
                    ESSID:"nixcraft"
                    Mode:Managed
                    Channel:6
                    Encryption key:on

Step #1: Set SSID/ESSID

You need to set ssid/essid. My SSID is nixcraft. The SSID/ESSID is used to identify cells which are part of the same virtual (wireless) network:

# iwconfig ra0 essid nixcraft

Step #2: Set mode

You need to set the operating mode of the PCI card. Use Managed mode that node connects to a network composed of many Access Points (wireless router).

# iwconfig ra0 mode Managed

Step 3: Setup channel

Set the operating frequency or channel in the device.

# iwconfig ra0 channel 6

Step 4: Setup key

Used to manipulate encryption or scrambling keys and security mode (you can obtain security key by opening your web browser and type your routers IP address into address bar):

# iwconfig ra0 key 47b1122774d1xy55a1194lchjk6

You can now ping to wireless router or browser internet and rest of network (if connected).

Step #8: Configure rt61 driver auto-load at boot time

#1: Configure ra0 interface so that it can activated after reboot. Create a wlan.up and wlan.down helper scripts. Download these scripts and copy to /etc/Wireless directory.

#2: Make sure wireless kernel modules (rt61) to load at boot time. Open config file /etc/modules (this file contains the names of kernel modules that are to be loaded at boot time, one per line.):

# vi /etc/modules

Append rt61 module:

rt61

Close and save the file.

#3: Configure ra0 ip address:
Open /etc/network/interfaces file:

# vi /etc/network/interfaces

Make sure ra0 interface look like as follows (static IP configuration):

auto ra0
iface ra0 inet static
name Wireless LAN card
address 192.168.1.2
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.1
post-up /etc/Wireless/wlan.up
post-down /etc/Wireless/wlan.down

Save the file and reboot the system.

Furhter references

  • Official driver site
  • Please read iwconfig, ifconfig and networking related man pages.
  • Please read driver readme file for more information