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
Your Reply