Howto Setup a Access Point with RaLink r61

This post is dedicated to my trials and the perils of trying to setup hostapd with a RaLInk rt2561/rt61 pci wireless network card.  It has been a long hard road, mostly because documentation is scarse.  To get an idea of what’s out there, have a look at the AP-mode “howto”.  Note the humorous comment at the beginning…”[it] is not aimed for beginners.  Hell, that howto isn’t aimed for anyone as far as I’m concerned.  So, let’s see if we can’t do a little better.

First, you’ll need to install

  • libnl-1.1 or better
  • udev-1.25 or better (I’m using 1.35, but apparently 1.25 will do)
  • hostap-0.70 or better (use git clone git://w1.fi/srv/git/hostap.git)
  • linux-2.6.29-rc6 or better

Okay, first we’ll take care of the kernel.  Make sure that the soft link /usr/src/linux points to your shiny new kernel’s source.   We also need to patch the net/mac80211/cfg.c file.   Go ahead and open this file and towards the very beginning, change…

static bool nl80211_type_check(enum nl80211_iftype type)
{
switch (type) {
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_MONITOR:
#ifdef CONFIG_MAC80211_MESH
case NL80211_IFTYPE_MESH_POINT:
#endif
case NL80211_IFTYPE_WDS:
return true;
default:
return false;
}
}

to this…

static bool nl80211_type_check(enum nl80211_iftype type)
{
switch (type) {
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_MONITOR:
#ifdef CONFIG_MAC80211_MESH
case NL80211_IFTYPE_MESH_POINT:
#endif
case NL80211_IFTYPE_WDS:
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
return true;
default:
return false;
}
}

Finally, compile the kernel and the RaLink driver (Device Drivers -> Network Device Support -> Wireless Lan -> Ralink Driver Support).

Next, we’ll take care of hostapd.  Enter the hostap/hostapd directory and copy defconfig to .config.  Now, edit .config and set the driver to nl80211.  You should have CONFIG_DRIVER_NL80211=y.  Run “make” and hopefully everything compiles.  Edit hostapd.conf to your liking.  In particular, you will want to change the country code and channel to whatever is appropriate and the driver to nl80211.  I followed the steps in this nice tutorial to get WPA-PSK set working with hostapd,  At this point, you should be able to fire up hostapd with ./hostapd -d hostapd.conf and be up for business.

As I said before, I had a number of problems when trying to set this up.  Here are some pitfalls to avoid…

  • Make sure you can set the channel of your device.  The iw tool set can help out here.  Something along the lines of “iw dev wlan0 set channel 8″ should work for you.  If it doesn’t, make sure you are using a 2.6.29-rcX kernel.
  • You MUST patch the net/mac80211/cfg.c file or your device will not be able to enter into master (AP) mode.
  • iwconfig is useless as far as hostap is concerned.  You won’t be able to use it to get into master mode.  Don’t even try.  Not even once.

Of course, once you get your ap up and running, you’ll need to setup a dhcp server to handle ip address for your clients and also do some routing/forwarding for them.  Perhaps, I’ll touch on that next time.

Also, please inform us of your own success and any pitfalls you encountered and overcame.

One Response to “Howto Setup a Access Point with RaLink r61”

  1. Hoxzer Says:

    I managed to get rt61pci to work as a master with hostapd 0.7.0 and vanilla 2.6.30 kernel. So apparently rt2×00 kernel is no longer needed.

    Distribution: Debian Squeeze

Leave a Reply