Candela Technologies Logo
Loading
http://www.candelatech.com
sales@candelatech.com
+1 360 380 1618 [PST, GMT -8]
Network Testing and Emulation Solutions
Virtual STA and AP interfaces with ath5k

NOTE: This assumes you are using the latest (2.6.38+ wireless-testing kernel) and up-to-date wireless tools (hostap, iw, iwconfig, etc)

This documents how to use features in the latest kernels to implement implement virtual WiFi station and AP interfaces.

  1. Download the wireless-testing kernel. The standard upstream wireless-testing kernel should be sufficient, but you may wish to try out Candela's patched kernel: It has a few fixes and optimizations that have not yet been accepted upstream:
    git clone dmz2.candelatech.com:/pub/scm/linux.wireless-testing.ct
      or upstream kernel:
    git clone git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
  2. Configure your kernel: Enable ath9k, ath9k, and the debugging features for each. Enable the mac80211 debugging as well.
  3. Fedora 11 (at least) comes with the tools needed to run virtual STA interfaces. You will have to compile hostapd yourself. We test with some modifications to hostapd, though the upstream code should work fine for most scenarios:
    git clone git://github.com/greearb/hostap-ct.git hostap
      or upstream project:
    git clone git://w1.fi/srv/git/hostap.git
  4. Disable HW encryption, since that cannot work with multiple virtual interfaces:
    echo options ath5k nohwcrypt=1 >> /etc/modprobe.d/ath5k.conf
    echo options ath9k nohwcrypt=1 >> /etc/modprobe.d/ath9k.conf
  5. Tell udev to keep away from your virtual interfaces:
    vi /lib/udev/rules.d/75-persistent-net-generator.rules
    
    #KERNEL!="eth*|ath*|wlan*[0-9]|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
    KERNEL!="eth*|ath*|ra*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
    
    # Optional, udev can be a pain, this may help make it less obtrusive.
    # Skip virtual interfaces of all types.  This doesn't actually do
    # anything for wifi interfaces, by the way.
    SUBSYSTEM=="net", ACTION=="add", ATTR{iflink}!=ATTR{ifindex}, GOTO="persistent_net_generator_end"
    
    
  6. Remove existing udev rules for ath5k/ath9k devices:
    # delete lines similar to this in 70-persistent-net.rules, if it exists.
    # PCI device 0x168c:0x0013 (ath5k)
    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0b:6b:83:5f:a6", ATTR{type}=="1", NAME="wlan0"
    
  7. NOTE: The radio-dev-name is 'phy0' by default, but it will change if you reload the module or if you explicitly rename it.
    To create/delete virtual interfaces:
    iw dev [radio-dev-name] interface add [virtual-sta-name] type station
    iw dev [radio-dev-name] interface add [virtual-ap-name] type __ap
    ip link set [interface-name] address [unique-mac-addr]
    To delete virtual interface:
    iw dev [dev-name] del
  8. After the devices are created, they may be configured like any other wifi device. We have successfully tested more than 128 stations and up to 4 APs using ath9k and our code trees.
  9. If you would like a pre-packaged testing solution, consider Candela Technologie's WiFi load-testing products:

 


Candela Technologies, Inc., 2026 Main Street, Suite A, P.O. Box 3285, Ferndale, WA 98248, USA
www.candelatech.com | sales@candelatech.com | +1 360 380 1618


Candela Technologies, 2026 Main Street, Suite A, P.O. Box 3285, Ferndale, WA 98248, USA
www.candelatech.com | sales@candelatech.com | +1 360 380 1618
Last modified: Mon Feb 21 21:47:54 PST 2011