Community Forum

Resolved
0 votes
After many many months of hacking at my wireless card, i've finally managed to get it running in master mode - I'd previously thought it was impossible until I found some short nuggets on information on the net....recent kernel upgrades have also helpd. I've now managed to build hostapd so that it supports nl80211 and the latest madwifi drivers. This means I can now run my rt61pci card in master mode as an access point! :D

Requirements:
At least kernel-2.6.18-194 (as provided in ClearOS5.2 SP1) as this comes with v2.3.0 of module rt61pci
Any of my testing kernel-2.6.32.x series will also do :)
Updated version of libnl (see RPM below)
Card firmware

My card:
01:08.0 Network controller: RaLink RT2561/RT61 802.11g PC
[root@starlane ~]# modinfo rt61pci
filename: /lib/modules/2.6.18-194.8.1.v5/kernel/drivers/net/wireless/rt2x00/rt61pci.ko
license: GPL
firmware: rt2661.bin
firmware: rt2561s.bin
firmware: rt2561.bin
description: Ralink RT61 PCI & PCMCIA Wireless LAN driver.
version: 2.3.0
author: http://rt2x00.serialmonkey.com
srcversion: 837F6BFF59EED4FCA542D27
alias: pci:v00001814d00000401sv*sd*bc*sc*i*
alias: pci:v00001814d00000302sv*sd*bc*sc*i*
alias: pci:v00001814d00000301sv*sd*bc*sc*i*
depends: rt2x00lib,rt2x00pci,eeprom_93cx6,crc-itu-t
vermagic: 2.6.18-194.8.1.v5 SMP mod_unload 686 REGPARM 4KSTACKS gcc-4.1
parm: nohwcrypt:Disable hardware encryption. (bool)
I


Installation:-
1. First configure your card from the webconfig (give it a static IP on it's own subnet, and LAN or HotLAN role)

2. Download the card firmware from http://www.ralinktech.com/support.php?s=2
Extract and save all three *.bin files into /lib/firmware

3. Install
Setup the community repo as per instructions HERE
yum --enablerepo=timb install hostapd

If your running a newer kernel-2.6.32+ you can use a new version of hostapd
yum --enablrepo=timb-testing --enablerepo=timb install hostapd


4. Edit config at /etc/hostapd.conf, as a minimum you will need to add the interface name (wlan0), the hw_mode (a,b or g), channel number (1-13), and ssid. You can also select the madwifi driver if using an Atheros card by changing the driver name. Driver options are: hostap / wired / madwifi / nl80211

If you want WPA2 uncomment the four lines and the passphrase. The passphrase needs to be greater than 8 characters long.

# Uncomment these for base WPA & WPA2 support with a pre-shared key
wpa=3
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

# DO NOT FORGET TO SET A WPA PASSPHRASE!!
wpa_passphrase=mypassphrase

# Most modern wireless drivers in the kernel need driver=nl80211
driver=nl80211

# Customize these for your local configuration...
interface=wlan0
hw_mode=g
channel=1
ssid=RT61PCI-AP

5. Then run 'service hostapd start'

You should now find that your card has entered master mode, (run 'iwconfig' to check) and that your access point is now available to be connected to.

6. DHCP
Before you can connect you will need to enable DHCP on this interface. You can do this from the webconfig

Troubleshooting
Errors and client handshakes are displayed in /var/log/messages
Debugging - run 'service hostapd stop' then from the console 'hostapd -d /etc/hostapd.conf' to get the debug output
Frequent start/stops of the service may result in the driver crashing due to the virtual wlan0 interface. Disable the interface and reload the module to start again,
service hostapd stop
ifconfig wlan0 down
modprobe -r rt61pci
modprobe rt61pci
service hostapd start

If things are still a bit flaky try the newer 2.6.32 kernels

Thanks! :) i'm posting this from my laptop connected at 54mpbs using WPA2-PSK, with throughput of 25Mbps


For the technically minded:-
I have also provided hostapd-0.7.3 (the latest version) but this requires the 2.6.32 kernel due to upgrades in the nl80211 driver. Feel free to try this version also. 0.6.9 works well with the 2.6.18 kernels...
You cannot use iwconfig to set master mode, the rt2x00 drivers for the rt61 card only permit hostapd to make these changes
The config file provided is a simplified version of the actual hostapd config. There are many more configurations available...see the hostapd source for details
You can configure more complex environments such as radius authenticaton, see hostapd docs for info
Thursday, December 16 2010, 01:13 PM
Share this post:
Responses (23)
  • Accepted Answer

    Even
    Even
    Offline
    Saturday, November 05 2011, 11:50 AM - #Permalink
    Resolved
    0 votes
    I get "deauthenticated due to local deauth request" twice a day, do anyone know how to fix this.

    Thank you :kiss:
    The reply is currently minimized Show
  • Accepted Answer

    Tim Davis
    Tim Davis
    Offline
    Monday, October 17 2011, 12:24 PM - #Permalink
    Resolved
    0 votes
    Thats for the response Tim.

    I had followed your tutorial to the T. After I got the nl80211 driver failure I figured maybe I needed a new version of libnl so I tried compile/install. I wasn't aware that yours included everything.

    I tried both of your yum installs and both get the same error. I'm using COS 5.2, with the exact same driver rt61pci. I can't give more details since I'm already at work, but I can later this evening.
    The reply is currently minimized Show
  • Accepted Answer

    Monday, October 17 2011, 11:48 AM - #Permalink
    Resolved
    0 votes
    If you install hostapd from my repo, it will pull in the updated libnl RPM
    http://download.clearfoundation.com/community/timb80/repo/clearos/5.2/os/

    Which version are you using? as newer versions of hostapd are not supported on the existing kernel
    The reply is currently minimized Show
  • Accepted Answer

    Tim Davis
    Tim Davis
    Offline
    Sunday, October 16 2011, 10:25 PM - #Permalink
    Resolved
    0 votes
    Does this method still work? In the instructions it says see libnl RPM below but there isn't one? I've tried compiling from source but keep getting a flex error. Starting hostapd results in:


    Starting hostapd: /etc/hostapd.confnl80211: Could not add multicast membership for scan events: -2 (No such file or directory)
    nl80211 driver initialization failed.
    rmdir[ctrl_interface]: No such file or directory
    [FAILED]

    Thanks
    The reply is currently minimized Show
  • Accepted Answer

    andy
    andy
    Offline
    Wednesday, July 06 2011, 03:17 AM - #Permalink
    Resolved
    0 votes
    sorry it's been so long since replying...summer has been absolutely nuts so far. been working like crazy and just moved into a new place...so ready to start playing with the wifi here again.


    lspci -vv

    03:06.0 Network controller: Atheros Communications Inc. AR922X Wireless Network
    Subsystem: Atheros Communications Inc. Device 2091
    Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr- Step
    Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort
    Latency: 168, Cache Line Size: 64 bytes
    Interrupt: pin A routed to IRQ 21
    Region 0: Memory at feb90000 (32-bit, non-prefetchable) [size=64K]
    Capabilities: [44] Power Management version 2
    Flags: PMEClk- DSI- D1- D2- AuxCurrent=100mA PME(D0+,D1-,D2-,D3h
    Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
    Kernel driver in use: ath9k
    Kernel modules: ath9k


    here's modprobe.conf

    alias eth0 e1000
    alias eth1 r8169
    alias scsi_hostadapter ahci
    alias snd-card-0 snd-hda-intel
    options snd-card-0 index=0
    options snd-hda-intel index=0
    remove snd-hda-intel { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; }; /sbin/modprobe -r --ignore-remove snd-hda-intel
    alias wlan0 ath9k



    here's my hostapd.conf:

    ctrl_interface=/var/run/hostapd
    ctrl_interface_group=wheel

    # Some usable default settings...
    macaddr_acl=0
    auth_algs=1
    ignore_broadcast_ssid=0

    # Uncomment these for base WPA & WPA2 support with a pre-shared key
    wpa=3
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=TKIP
    rsn_pairwise=CCMP

    # DO NOT FORGET TO SET A WPA PASSPHRASE!!
    wpa_passphrase=**********

    # Most modern wireless drivers in the kernel need driver=nl80211
    driver=nl80211

    # Customize these for your local configuration...
    interface=wlan0
    hw_mode=g
    channel=9
    ssid=bainwall
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 27 2011, 11:29 AM - #Permalink
    Resolved
    0 votes
    Whats the output of 'lspci' for your card? no need to post the other sections. Are you using the ath9k driver?

    Can you also post the output of /etc/modprobe.conf?

    What does your hostapd.conf look like?
    The reply is currently minimized Show
  • Accepted Answer

    andy
    andy
    Offline
    Thursday, May 26 2011, 11:23 PM - #Permalink
    Resolved
    0 votes
    popped in my tp-link tl-wn851n
    Atheros Communications Inc. AR922X Wireless Network Adapter PCI


    updated my kernal

    configured wlan0 from the webconfig
    enabled dhcp

    configured hostapd
    started it

    ....no ssid broadcast

    iwconfig shows it's running master mode:
    [root@firewall ~]# iwconfig wlan0
    Warning: Driver for device wlan0 has been compiled with version 22
    of Wireless Extension, while this program supports up to version 20.
    Some things may be broken...

    wlan0 IEEE 802.11bgn Mode:Master Frequency:2.452 GHz Tx-Power=20 dBm
    Retry limit:7 RTS thr:off Fragment thr:off
    Power Management:on


    figured maybe it doesn't broadcast the network maybe. added it in...no go

    here's my config dump, being that i'm command line ignorant... i r clueless hih yuck PTTT TING!
    [root@firewall ~]# hostapd -d /etc/hostapd.conf
    Configuration file: /etc/hostapd.conf
    ctrl_interface_group=10 (from group name 'wheel')
    nl80211: Register Action command failed: ret=-95 (Operation not supported)
    nl80211: Register Action match - hexdump(len=1): 06
    nl80211: Failed to register Action frame processing - ignore for now
    nl80211: Add own interface ifindex 4
    nl80211: New interface mon.wlan0 created: ifindex=18
    nl80211: Add own interface ifindex 18
    BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
    nl80211: Added 802.11b mode based on 802.11g information
    RATE[0] rate=10 flags=0x1
    RATE[1] rate=20 flags=0x1
    RATE[2] rate=55 flags=0x1
    RATE[3] rate=110 flags=0x1
    RATE[4] rate=60 flags=0x0
    RATE[5] rate=90 flags=0x0
    RATE[6] rate=120 flags=0x0
    RATE[7] rate=180 flags=0x0
    RATE[8] rate=240 flags=0x0
    RATE[9] rate=360 flags=0x0
    RATE[10] rate=480 flags=0x0
    RATE[11] rate=540 flags=0x0
    Completing interface initialization
    Mode: IEEE 802.11g Channel: 9 Frequency: 2452 MHz
    Flushing old station entries
    Deauthenticate all stations
    wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=(nil) key_idx=0 set_tx=1 seq_len=0 key_len=0
    wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=(nil) key_idx=1 set_tx=0 seq_len=0 key_len=0
    wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=(nil) key_idx=2 set_tx=0 seq_len=0 key_len=0
    wpa_driver_nl80211_set_key: ifindex=4 alg=0 addr=(nil) key_idx=3 set_tx=0 seq_len=0 key_len=0
    Using interface wlan0 with hwaddr 54:e6:fc:de:d0:9d and ssid 'bainwall'
    Deriving WPA PSK based on passphrase
    SSID - hexdump_ascii(len=8):
    62 61 69 6e 77 61 6c 6c bainwall
    PSK (ASCII passphrase) - hexdump_ascii(len=10): [REMOVED]
    PSK (from passphrase) - hexdump(len=32): [REMOVED]
    WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
    GMK - hexdump(len=32): [REMOVED]
    GTK - hexdump(len=32): [REMOVED]
    WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
    wpa_driver_nl80211_set_key: ifindex=4 alg=2 addr=(nil) key_idx=1 set_tx=1 seq_len=0 key_len=32
    nl80211: Set beacon (beacon_set=0)
    wlan0: Setup of interface done.
    RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()
    RTM_NEWLINK, IFLA_IFNAME: Interface 'mon.wlan0' added
    Unknown event 5
    RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()
    RTM_NEWLINK, IFLA_IFNAME: Interface 'mon.wlan0' added
    Unknown event 5
    RTM_NEWLINK: operstate=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
    RTM_NEWLINK, IFLA_IFNAME: Interface 'mon.wlan0' added
    Unknown event 5
    RTM_NEWLINK: operstate=0 ifi_flags=0x1002 ()
    RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
    Unknown event 5
    RTM_NEWLINK: operstate=0 ifi_flags=0x11043 ([UP][RUNNING][LOWER_UP])
    RTM_NEWLINK, IFLA_IFNAME: Interface 'wlan0' added
    Unknown event 5
    ^CSignal 2 received - terminating
    Flushing old station entries
    Deauthenticate all stations
    nl80211: Remove interface ifindex=18
    netlink: Operstate: linkmode=0, operstate=6


    i shouldn't have to use the mad wifi driver should i?
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, March 15 2011, 12:08 PM - #Permalink
    Resolved
    0 votes
    thanks for download direct link
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, March 15 2011, 11:30 AM - #Permalink
    Resolved
    0 votes
    Hi, no reason i'm aware of! must have been lost in the reshuffle...i'll move it back

    The servers will sync up in due course, but you can grab it manually from here
    ftp://timburgess.net/repo/clearos/5.2/os/hostapd-0.6.9-8.clearos.i686.rpm
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, March 15 2011, 10:59 AM - #Permalink
    Resolved
    0 votes
    Hi,

    hostapd (0.6.9) on timb repo (not the testing one) is no more available.

    Is there any reason about this Unavailability ?

    regards
    The reply is currently minimized Show
  • Accepted Answer

    Friday, January 28 2011, 06:12 PM - #Permalink
    Resolved
    0 votes
    Hi!

    This took some time, but I finally have the time to look into this now. I hope you guys still have some clues to me.

    I don't think the explanation I gave about the issue was good enough the first time, so to be clear; My devices will connect, but they just stay connected for anything between a few seconds to several minutes.

    Here's the results from Tim Burgess' suggestions:

    [ul]Static IP gave the same result[/ul][ul]I did also play a little around with the DHCP setting. I run the same subnet for the cabeled and the wireless net (192.168.1.0, but I tried to change the wierless to a different subnet without any change in the behaviour[/ul][ul]My HW..? Well, it's a old PC, approx 6-7 years celeron. The wireless NIC is a gigabyte card wit rt61pci chipset[/ul][ul]The only thing that gave any sense (for me) from the hostapd.conf and messages files was this message: Jan 23 04:22:50 system kernel: ieee80211_tx_status: headroom too small (who I think may give problems like this)[/ul]

    Does any of this mean anything to you guys?

    Thanks in advance.

    BR
    Boffen B)
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, January 08 2011, 08:39 PM - #Permalink
    Resolved
    0 votes
    Hi Boffen, thanks for the feedback :) what hardware are you using as your AP?

    I'm suprised that they are not all able to use WPA2. Are you sure they are configured correectly? using WPA2-PSK (AES)? You could drop the security to WEP but that would be a big drop down, and not really recommended for networks as it's easy to crack.

    Are you sure it's not a DHCP issue? i.e. can they connect OK if you specify a static IP address

    You can also enable debug output, and run it from the console...
    service hostapd stop
    hostapd -d /etc/hostapd.conf

    Press Ctrl-C to quit and make a note of any errors / logs. You can also look in /var/log/messages for clues
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, January 08 2011, 12:42 PM - #Permalink
    Resolved
    0 votes
    First of all; Dear Tim Burgess, this guide saved my day. Thank you!

    However, I ran into a little bump in the road after configuring everything. It seems like the AP runs as i should because it works great on my work-PC (Win7 highend IBM/Lenovo) and on a Logitech Squeezebox. But not on my mobile devices and my private laptop.

    It seems like there's some compability issues with the encryption methods. I think there should be sufficiant WPA2 support in all my devices, a Win Vista :S 4 years old PC, a Win 6.1 mobile (Sony Ericsson X1) and a Samsung Tab with android 2.2.

    This might be a little bit of topic, but there might be more people who need to use anoter encryption-configuration as well as me.

    Do anyone have an ide about where the problem is. Do I have to run it as WEP only, and how do I do that?

    Best Regards
    Boffen
    The reply is currently minimized Show
  • Accepted Answer

    Raquel Wey
    Raquel Wey
    Offline
    Tuesday, December 21 2010, 12:39 AM - #Permalink
    Resolved
    0 votes
    How should I test out my AP? Is there a procedure? I've been using it daily since I set it up and haven't run into any issues so far, but I haven't changed anything in the configuration since initially installing it except to bridge it with the servers two other wired ethernet ports for the LAN.

    I also had a wifi card with a Ralink chip but I opted for the ath9k because it appeared to be the easiest one to set up. If anyone is looking for a recommendation, I used Dlink DWA-552.

    Everything that I've connected so far works - netbook, iPod and Xbox - though I have not tried Xbox live yet.

    The only weak link in my setup is my internet connection, which is a 3G USB modem (MF-668, Rogers Rocketstick). It works well, when the sky is clear, the wind is blowing from the south, and the planets are all in alignment :S
    The reply is currently minimized Show
  • Accepted Answer

    Friday, December 17 2010, 09:34 PM - #Permalink
    Resolved
    0 votes
    Racquel, hopefully the RPM's will save others the grief that I and you endured to get it up and running! :) hopefully you'll be able to help test with your ath9k chip?

    David, this list is a good starting point... any of the Ralink rtXX cards based on the r2x00 drivers should be ok. Indeed Radius to provide the authentication, matched with Hostapd, and then captive portal makes an intruiging combination!.....am I right in thinking a MIPS kernel would open up the embedded device market then you could have ClearOS running on your home router :ohmy:
    http://linuxwireless.org/en/users/Drivers

    Marcel, I love the challenge :side:
    The reply is currently minimized Show
  • Accepted Answer

    Friday, December 17 2010, 08:09 PM - #Permalink
    Resolved
    0 votes
    Tim Burgess wrote:
    :D hehe master mode is like the holy grail of wireless networking, it turns your normal wireless PCI card - which normally can only connect to other existing networks, into an access point. This means you can setup a wireless network using your NIC, and don't need another NIC / Wireless router combo to do the job for you.

    Thanks David, let me know how it goes!


    :huh: , now i understand. I thought it was a card specially to act as a access point but you do this with a normal wireless card. Indeed COOL Tim.

    Do you you like your new job as developer... :)
    The reply is currently minimized Show
  • Accepted Answer

    Friday, December 17 2010, 08:08 PM - #Permalink
    Resolved
    0 votes
    Correct, with the previous WPA2 infrastructure piece that was done, and the hostapd, we only need a good list of Wireless NICs that support master mode that have been tested on ClearOS and you can have a directory-enabled wireless access node.

    This means that you can create a ClearOS Wireless access point that has a backup replicate of the directory so if your Wireless access is not able to connect to the master server, you can still cache the authentication. Add the captive portal stuff done recently as well, content filtration and voila... ClearOS Internet Cafe version.

    Now all we need is a MIPS kernel ;)
    The reply is currently minimized Show
  • Accepted Answer

    Raquel Wey
    Raquel Wey
    Offline
    Friday, December 17 2010, 06:34 PM - #Permalink
    Resolved
    0 votes
    I used this method to set up my AP and it's been running for over a month now with no issues. It actually seems to run more stable than the hardware it replaced.

    I did upgrade to the 2.6.32 kernel and the wireless card I used has an ath9k chip so I didn't need madwifi. I also had to compile libnl and hostapd from source since no working RPM's seemed to exist at the time - that would have saved me a lot of work, but it was a learning experience :)

    In fact, I was so shocked that it all worked (despite my lack of skills in this particular area) that if the old eServer I installed it on dies I'll be devastated LOL
    The reply is currently minimized Show
  • Accepted Answer

    Friday, December 17 2010, 01:17 PM - #Permalink
    Resolved
    0 votes
    Sweet!
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, December 16 2010, 08:08 PM - #Permalink
    Resolved
    0 votes
    :D hehe master mode is like the holy grail of wireless networking, it turns your normal wireless PCI card - which normally can only connect to other existing networks, into an access point. This means you can setup a wireless network using your NIC, and don't need another NIC / Wireless router combo to do the job for you.

    Thanks David, let me know how it goes!
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, December 16 2010, 06:34 PM - #Permalink
    Resolved
    0 votes
    David Loper wrote:
    Tim, this is sooo cool. As usual, you deliver some great technology. I'm eager to try this out.


    Why is this so cool? I try to understand this tread but master mode... Wow i'm getting dizzy of this stuff.

    I don't doubt your knowledge guys but to me it's like yeah like... :laugh:
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, December 16 2010, 03:40 PM - #Permalink
    Resolved
    0 votes
    Tim, this is sooo cool. As usual, you deliver some great technology. I'm eager to try this out.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, December 16 2010, 01:38 PM - #Permalink
    Resolved
    0 votes
    This page was also valuable for understanding how to get hostapd / nl80211 up and running
    http://wireless.kernel.org/en/users/Documentation/hostapd
    The reply is currently minimized Show
Your Reply