multiple ssid's over a single physical wireless interface

Hi guri at large ....

We are trying to utilize hostapd 0.7.3 in combination with FreeBSD 8.2 to broadcast multiple SSIDs over a single physical wireless interface. If we do this the way hostapd intends, adding multiple bss statements in the configuration, hostapd fails to start with the following output:

Code:
Using interface wlan0 with hwaddr 1c:4b:d6:90:f7:8b and ssid 'mode0_ap'
Failed to add BSS (BSSID=1c:4b:d6:90:f7:8c)
wlan0: Unable to setup interface
Failed to remove BSS interface wlan1

Our configuration is fairly minimalistic for the sake of debugging:

Code:
interface=wlan0
driver=bsd
hw_mode=g
channel=6

ssid=mode0_ap
wpa=2
wpa_pairwise=TKIP CCMP
wpa_passphrase=thisisasecret

bss=wlan1
bssid=1c:4b:d6:90:f7:8c
ssid=mode1_ap
wpa=2
wpa_pairwise=TKIP CCMP
wpa_passphrase=thisisalsoasecret

If we peruse the hostapd source we can see that the error message "failed to add BSS" is directly related to adding the interface specified on the bss= line through hostapd_if_add. This seems to fail for reasons yet unknown to us. But the nature of hostapd_if_add and the hapd->driver->if_add call within that function leads us to believe it might be a driver issue.

This problem is reproducible on all our hardware using several Atheros wireless chips and persists when running FreeBSD 8.1, 8.2 and 9.0-CURRENT, but appears to be restricted to FreeBSD or at the very least the BSD driver. As the configuration as is works perfectly on Linux with the nl80211 driver.

Does anyone have a clue here? We think that is might be an atheros device driver issue.

Rudi van Drunen
 
It's a general issue, FreeBSD's hostapd driver hasn't been told about how VAPs work. Currently you have start multiple instances, one for each VAP interface.
 
Voyage Linux Multi SSID VLAN Access Point

I spent a lot of time on Google trying to get this to work, so this post is simply some love for the next guy who is trying to get this to work:

I know that this isn't for FreeBSD, but I couldn't find anywhere better to stick the information. Sorry.

If you are using the nl80211 driver and want to get multiple SSID's working, this is how you do it:

First off you need to drop the interface into the /etc/network/interfaces.

Code:
# We are going to auto-start everything
auto lo eth0 eth1 br0 br1

# We are going to automagically assign an IP address to eth0
iface eth0 inet dhcp

# Create a loopback interface
iface lo inet loopback

# We are going to create a VLAN 2 interface on eth0
iface eth0.2 inet manual
        vlan_raw_device eth0

# We are going to create a VLAN 3 interface on eth0
iface eth0.3 inet manual
        vlan_raw_device eth0

# Now we are going to bring eth1 up without an IP address
iface eth1 inet manual
        pre-up ifconfig eth1 up
        post-down ifconfig eth1 down

# We are going to create a bridge that includes eth1, eth0.2
# In our case we are going to be using eth1 for a debug port, etc.....
iface br0 inet static
        bridge_ports eth0.2 eth1
        bridge_stp on
        bridge_maxwait 10
        address 192.168.1.20
        broadcast 192.168.1.255
        netmask 255.255.255.0

# Create another bridge interface, but without an ip
iface br1 inet manual
        bridge_ports eth0.3
        bridge_stp on
        bridge_maxwait 10

# Now we are going to start working wireless magic.
auto wlan0
iface wlan0 inet manual
        pre-up ifconfig wlan0 up
        # For some reason hotapd doesn't bridge the second SSID into the bridge
        # so we are going to do it after the interface is up.
        post-up brctl addif br1 wlan1
        post-down ifconfig wlan0 down
        # call hostapd and pass it the config file
        hostapd /etc/hostapd/hostapd.wlan0.conf

Next, here is the hostapd.wlan0.conf file we are going to be using.

Note: Before you set this, you need to know the MAC of the physical interface. You can get this by typing ifconfig wlan0. In our case, the physical interface is 00:0e:96:00:00:c9.

Code:
interface=wlan0
driver=nl80211
logger_syslog=1
logger_syslog_level=1
logger_stdout=1
logger_stdout_level=1
debug=4
#dump_file=/tmp/hostapd.dump
#ctrl_interface=/var/run/hostapd
#ctrl_interface_group=0
# Here is where we assign the SSID to a bridge interface
bridge=br0
# This is the channel
channel=11
# This is the mode we are going to set the card to.
hw_mode=g
macaddr_acl=0
auth_algs=3
eapol_key_index_workaround=0
eap_server=0
wpa=3
# Here is the SSID
ssid=VoyageSecure
wpa_passphrase=supersocks
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
eapol_version=1
#wme_enabled=1
#ieee80211n=1
#ht_capab=[HT40-][HT40+][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40]

# This is the second SSID, you can set pretty much all of the variables to what you want, 
# except for physical variables (like channel) that need to be the same across interfaces.
# Obviously if you are running two virtual SSIDs on the same physical radio, you can't run
# them on different channels (yet).  Someday maybe.  
bss=wlan1
bssid=00:0e:96:00:00:ca
ssid=VoyagePremium
hw_mode=g
channel=11
# In theory, this connects the SSID to the br1 interface.  In reality it doesn't work
# hence the hack in the /etc/network/interfaces file.
bridge=br1

That's it. Hopefully it saves someone a bunch of time.
 
In the process description, you indicated to note the physical wireless MAC address, which you indicated was 00:0e:96:00:00:c9 in your case, yet the BSSID you specified for the second SSID is 00:0e:96:00:00:ca which doesn't quite match what you had for the physical address.
Was that a typo? If not, what are we supposed to do with the physical wireless MAC address?

Wait, just realized the BSSID is one up from the physical. Is that what was intended?, as it wasn't specified.
 
Tried it quickly, getting error in command [coded]brctl br-guest wlan1' : iface wlan1: no such device[/code] Which is true in my Linux, there isn't such a device (note br-guest is what you called br1).

I see where you try and tie br1 to wlan1 in the configuration file by having
Code:
bss=wlan1
and
Code:
bridge=br1
but it doesn't look like the wlan1 interface is created upon bringing up wlan0.

Also, I found hostapd-phy0.conf in /var/run, is that the file I am supposed to edit and run against hostapd, or am I supposed to have a separate static file in /etc/hostapd? Incidentally, my Linux has a different procedure to set up networking, so there isn't an /etc/network folder. Did you create /etc/hostapd that you have hostapd.wlan0.conf, or did it already exist based on your network model?
 
I know it's a bit of a necrobump, but this came up in a search for a problem that I was running into. So I want to share how I made multiple SSIDs access points on one WIFI card work on FreeBSD 14.0.

When I tried to set up a separate interface via hostapd.conf I was getting an error that it couldn't create an identical or a different bssid when I would start hostapd. I actually read somewhere that my ath wifi card didn't allow changing its bssid in hostap mode.

Turns out that's bull crap, my ath card does allow different bssids. What I had to do was create two separate wlan interfaces with the bssid option added "ifconfig wlanN create wlandev ath0 wlanmode hostap bssid". When this creates a hostap interface it assigns it a random bssid!

All I had to do afterwards was create two separate hostapd.conf and launch two instances of hostapd for each interface/configuration. And of course, do separate NATs for each interface subnet. And voila.
 
Back
Top