how do I run multiple hostapd's on multiple virtual nic's with nl80211

Cory Coager ccoager
Wed Jan 12 16:38:55 PST 2011


I am gentoo user that had this working with the madwifi driver but I
recently upgraded my kernel and I'm having a lot of trouble with the new
nl80211 driver. I used to run two separate hostapd daemons with
different configs and I was able to run two separate access points. If I
do that now with the nl80211 driver I get an error starting the second
daemon:

* Caching service dependencies ...
 * Starting ath1
 *   Running preup function
 *   Changing MAC address of ath1 ...
 *     changed to 00:AE:82:44:01:18
 *   Configuring wireless network for ath1
Error for wireless request "Set ESSID" (8B1A) :
    SET failed on device ath1 ; Device or resource busy.
 *   ath1 does not support setting ESSID to "gentoo"
 *   Failed to configure wireless for ath1
 * ERROR:  cannot start hostapd1 as net.ath1 could not start


If I try to start the service again, it starts but that is because the
first interface was downed during the 'iw' operation.
* Starting ath1
 *   Running preup function
 *   Changing MAC address of ath1 ...
 *     changed to 00:AE:82:44:01:18
 *   Configuring wireless network for ath1
 *     ath1 connected to ESSID "gentoo" at 00:00:00:00:00:00
 *     in ad-hoc mode on channel 3 (WEP disabled)
 *   Bringing up ath1
 *     192.168.5.1/24
 * Starting hostapd1 ...
Configuration file: /etc/hostapd/hostapd1.conf
Using interface ath1 with hwaddr 00:AE:82:44:01:18 and ssid 'gentoo'


Here notice that ath0 is DOWN and ath1 is UP:
ath0      Link encap:Ethernet  HWaddr 00:AE:82:44:01:17
          inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:60312 errors:0 dropped:0 overruns:0 frame:0
          TX packets:107323 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5914689 (5.6 MiB)  TX bytes:149544981 (142.6 MiB)

ath1      Link encap:Ethernet  HWaddr 00:AE:82:44:01:18
          inet addr:192.168.5.1  Bcast:192.168.5.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:120 (120.0 B)


/etc/hostapd/hostapd.conf:
country_code=US
bssid=00:AE:82:44:01:17
interface=ath0
driver=nl80211
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=1
dump_file=/tmp/hostapd0.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ignore_broadcast_ssid=1
ssid=ootneg
hw_mode=g
channel=1
macaddr_acl=1
accept_mac_file=/etc/hostapd/hostapd.accept
auth_algs=1
wpa=0


/etc/hostapd/hostapd1.conf:
country_code=US
bssid=00:AE:82:44:01:18
interface=ath1
driver=nl80211
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=1
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ignore_broadcast_ssid=0
ssid=gentoo
hw_mode=g
channel=8
macaddr_acl=0
auth_algs=1
wpa=1
wpa_passphrase=secret
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP


/etc/conf.d/net:
config_ath0=( "192.168.2.1/24" )
mac_ath0=( "00:AE:82:44:01:17" )
mode_ath0=( "ad-hoc" )
essid_ath0=( "ootneg" )

config_ath1=( "192.168.5.1/24" )
mac_ath1=( "00:AE:82:44:01:18" )
mode_ath1=( "ad-hoc" )
essid_ath1=( "gentoo" )

preup() {
  if [[ ${IFACE} == "ath0" || ${IFACE} == "ath1" ]]; then
    iw dev wlan0 interface add ${IFACE} type __ap
    rfkill unblock all
  fi
}
postdown() {
  if [[ ${IFACE} == "ath0" || ${IFACE} == "ath1" ]]; then
    iw dev ${IFACE} del
    iw dev mon.${IFACE} del
  fi
}


hostapd version:
[D] net-wireless/hostapd
     Available versions:  0.6.8 0.6.9{tbz2} {ipv6 logwatch madwifi ssl wps}
     Installed versions:  0.7.3(09:13:48 01/11/11)(debug logwatch
madwifi ssl wps -ipv6)
     Homepage:            http://hostap.epitest.fi
     Description:         IEEE 802.11 wireless LAN Host AP daemon


uname -a:
Linux gentoo 2.6.36-hardened-r6 #3 Tue Jan 11 22:19:39 EST 2011 i686 AMD
Athlon(tm) Processor AuthenticAMD GNU/Linux

How do I accomplish this?



More information about the Hostap mailing list