# hostapd won't start on AR9280



## unknownuser (May 28, 2017)

Hello folks. I got this APU2C4 last week to use as all in one router, firewall, AP with FreeBSD 11. It has two mini PCIe Compex WLE200NX that uses the Atheros AR9280 chipset.

I am going to be posting my configuration, hoping that someone can shed some light on what I am doing wrong.

# hostapd -dd /etc/hostapd.conf

```
Configuration file: /etc/hostapd.conf
ctrl_interface_group=0
pcap_open_live: wlan0           : No such device exists (BIOCSETIF failed: Device not configured)
ifname='wlan0           '
bsd driver initialization failed.
hostapd_interface_deinit_free(0x801c2c000)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x801c2c000)
wlan0           : interface state UNINITIALIZED->DISABLED
hostapd_bss_deinit: deinit bss wlan0         
wlan0           : AP-DISABLED
hostapd_cleanup(hapd=0x801c6f000 (wlan0           ))
hostapd_free_hapd_data: Interface wlan0            wasn't started
hostapd_interface_deinit_free: driver=0x0 drv_priv=0x0 -> hapd_deinit
hostapd_interface_free(0x801c2c000)
hostapd_interface_free: free hapd 0x801c6f000
hostapd_cleanup_iface(0x801c2c000)
hostapd_cleanup_iface_partial(0x801c2c000)
hostapd_cleanup_iface: free iface=0x801c2c000
```

cat /etc/hostapd.conf

```
interface=wlan0               
ctrl_interface=/var/run/hostapd 
ctrl_interface_group=0
ssid=fanculo                 
wpa=2                         
wpa_passphrase=freebsd11   
wpa_key_mgmt=WPA-PSK           
wpa_pairwise=CCMP
```

dmesg |grep ath0

```
ath0: <Atheros 9280> mem 0xfe400000-0xfe40ffff at device 0.0 on pci1
ath0: [HT] enabling HT modes
ath0: [HT] 1 stream STBC receive enabled
ath0: [HT] 1 stream STBC transmit enabled
ath0: [HT] 2 RX streams; 2 TX streams
ath0: AR9280 mac 128.2 RF5133 phy 13.0
ath0: 2GHz radio: 0x0000; 5GHz radio: 0x00c0
```

ifconfig wlan0 list caps

```
drivercaps=4f8def41<STA,FF,IBSS,PMGT,HOSTAP,AHDEMO,TXPMGT,SHSLOT,SHPREAMBLE,MONITOR,MBSS,WPA1,WPA2,BURST,WME,WDS,TXFRAG>
cryptocaps=1f<WEP,TKIP,AES,AES_CCM,TKIPMIC>
htcaps=701ce<CHWIDTH40,SHORTGI40,TXSTBC>
```

ifconfig wlan0

```
wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 04:f0:21:2e:54:4a
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: IEEE 802.11 Wireless Ethernet autoselect mode 11na <hostap>
    status: running
    ssid "" channel 36 (5180 MHz 11a ht/20) bssid 04:f0:21:2e:54:4a
    regdomain FCC country US ecm authmode OPEN privacy OFF txpower 17
    mcastrate 6 mgmtrate 6 scanvalid 60 ampdulimit 64k ampdudensity 8
    shortgi wme burst dtimperiod 1 -dfs
    groups: wlan
```

# /etc/rc.conf

```
# Wireless HOSTAP
wlans_ath0="wlan0"
create_args_wlan0="wlanmode hostap"
ifconfig_wlan0="ssid fanculo mode 11n channel 11"
wlans_ath1="wlan1"
create_args_wlan1="wlanmode hostap"
hostapd_enable="YES"
```

full /etc/rc.conf can be found here.

# /boot/loader.conf

```
# Serial console boot
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole"
kern.cam.boot_delay="10000

# Bridge driver
if_bridge_load="YES"
bridgestp_load="YES"

# Atheros wireless drivers
if_ath_load="YES"

# Wireless cryptography
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
```

I do apologize for the long post but I wanted to make sure all possible needed info are here.

Thanks,
Pietro


----------



## aht0 (May 28, 2017)

Channel 36? One thing that may cause it. AFAIK you cannot do AP for 5GHz band using quite few of the AR9280 by default because card's firmware is limiting AP to 2,4GHz band only. You can only run 5GHz in client mode, unless you modify the fw and reflash it accordingly (process which, done wrong, could easily brick your card).  AR9280 fw is still rewritable, later models (AR9462) have OTP fw, which cannot be edited (more than once in factory, that is)

EDIT: (found the utilities I used for this from my Google Drive, sharing them out now)
AR9280/9285 EEPROM modification tool [Win7 32/64bit, sources included] - https://drive.google.com/open?id=0ByctOmTbMtGCSG9pNlB1NkNqQVU
Same thing, probably for Win8.1 [without sources] - https://drive.google.com/open?id=0ByctOmTbMtGCOHJ5UE14MHJVUWs

They originate from hackintosh forums, no longer available.

DO NOT MESS with custom RegDOM inputbox - I bricked 2 cards before I figured out, what's the correct hex to put in there (just digits, not starting with 0x). Changing MAC and unlocking 5Ghz band for AP should be both as safe as they could be though. They rely on unsigned modified Atheros driver which needs Windows to work with unsigned drivers enabled. IF I recall it right, getting unsigned driver support functioning on Win8.1 was real pita, I recommend using Windows 7.


----------



## Phishfry (May 28, 2017)

Use the KISS approach. You should first figure out how to get one card running in hostapd mode then add the second.

There are many settings in /etc/hostapd.conf you have which are no longer used.

I have the most simple setup here:
https://forums.freebsd.org/posts/348330/
I am currently using the APU3 as my AP.


----------



## unknownuser (May 29, 2017)

Hello folks, thanks for getting back to me.. Apparently I had the issue under my nose. To being with hostapd ignores any hw_mode other than a and g, and I had it set on N, secondly it totally ignored what I had in rc.conf related to it; `ifconfig_wlan0="ssid fanculo mode 11n channel 11"`, and for some reason this was preventing hostapd to start.

So I managed to get it going but I am now running into another sort of nightmare, and that is:

Line 6: unknown configuration item 'ieee80211n'


Apparently from what I understood `IEEE80211N` is disabled both from the hostapd binary included with system base as well as on the one in ports/pkg. Does this mean that I won't be getting 802.11n working?

And if so, is there any reason of why 802.11n has been disabled from hostapd?

At this point I don't know whether I should venture with compiling hostapd from source or rather going with pfsense, since they got it patched some 3 years ago.

I really wanted to avoid going pfsense, or anything other than pure FreeBSD really. But I already had to give up at 802.1ac, but giving up to 802.11n is really no option for me.

Thanks,
Pietro


----------



## Phishfry (May 29, 2017)

unknownuser said:


> And if so, is there any reason of why 802.11n has been disabled from hostapd?


hostapd.conf no longer has radio settings in it. All radio functions are handled by `ifconfig`.

N mode works fine and is the default. Just set the channel.


```
root@APU3:~ # ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
   ether 00:15:6d:84:b2:f6
   inet 192.168.100.1 netmask 0xffffff00 broadcast 192.168.100.255
   nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
   media: IEEE 802.11 Wireless Ethernet autoselect mode 11na <hostap>
   status: running
   ssid APU3 channel 157 (5785 MHz 11a ht/40+) bssid 00:15:6d:84:b2:f6
   regdomain FCC country US ecm authmode WPA2/802.11i privacy MIXED
   deftxkey 2 TKIP 2:128-bit TKIP 3:128-bit txpower 23 mcastrate 6
   mgmtrate 6 scanvalid 60 ampdulimit 64k ampdudensity 8 shortgi wme
   burst dtimperiod 1 -dfs
   groups: wlan
```

I switched to an Ubiquiti SR71-E with the same chipset you are using.

/etc/rc.conf

```
hostname="APU3"
ifconfig_igb0="DHCP"
ifconfig_igb1="inet 192.168.101.1 netmask 255.255.255.0"
ifconfig_igb2="inet 192.168.102.1 netmask 255.255.255.0"
sshd_enable="YES"
sendmail_enable="NONE"
clear_tmp_enable="YES"
dumpdev="NO"
wlans_ath0="wlan0"
create_args_wlan0="wlanmode hostap ssid APU3 channel 157"
hostapd_enable="YES"
ifconfig_wlan0="inet 192.168.100.1 netmask 255.255.255.0"
dnsmasq_enable="YES"
gateway_enable="YES"
pf_enable="YES"
pf_rules="/etc/pf.conf"
pflog_enable="YES"
```

/etc/hostapd.conf

```
interface=wlan0
ssid=APU3
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
wpa=2
wpa_passphrase=#####
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
```

/usr/local/etc/dnsmasq.conf

```
server=8.8.8.8
server=8.8.4.4
dhcp-range=wlan0,192.168.100.10,192.168.100.25,255.255.255.0,24h
dhcp-option=option:router,192.168.100.1
```

/etc/pf.conf

```
ext_if="igb0"
int_if="wlan0"
set skip on lo
nat on $ext_if inet from ! ($ext_if) to any -> ($ext_if)
```


----------



## Phishfry (May 29, 2017)

Also no need for those settings in your /boot/loader.conf except for your serial console settings.

There is no need for a Bridge or Wireless cryptography neither is `if_ath_load=` needed.


----------



## unknownuser (Jun 4, 2017)

Phishfry said:


> hostapd.conf no longer has radio settings in it. All radio functions are handled by `ifconfig`.
> 
> N mode works fine and is the default. Just set the channel.
> 
> ...




Hey thanks for the clarifications.

However I am still unable to set the wireless cards to transfer in n mode, and the maximum throughput I have managed to get is 19.5 Mbits/sec.


```
$ ifconfig wlan0
wlan0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 04:f0:21:2e:54:4a
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng <hostap>
    status: running
    ssid WirelessFreedom channel 11 (2462 MHz 11g ht/40-) bssid 04:f0:21:2e:54:4a
    regdomain FCC country US ecm authmode WPA2/802.11i privacy MIXED
    deftxkey 3 TKIP 2:128-bit TKIP 3:128-bit txpower 30 scanvalid 60
    protmode CTS ampdulimit 64k ampdudensity 8 shortgi wme burst
    dtimperiod 1 -dfs
    groups: wlan
```

And as you suggested I am now letting ifconfig handling channel and frequency


```
$ cat /etc/rc.conf |grep wlan0
wlans_ath0="wlan0"
create_args_wlan0="wlanmode hostap"
ifconfig_wlan0="channel 11:ht/40 up"
```

However bit-rate in linux and link speed in android are reporting 54MB/s, which among other things makes me believe the router is transferring in g still.

Also ifconfig -v wlan0 list channel shows no 11n channel options, any idea?


```
$ ifconfig -v wlan0 list channel
Channel   1 : 2412      MHz 11b          Channel   9 : 2452      MHz 11b        
Channel   1 : 2412      MHz 11g          Channel   9 : 2452      MHz 11g        
Channel   1 : 2412      MHz 11g ht/20    Channel   9 : 2452      MHz 11g ht/20  
Channel   1 : 2412      MHz 11g ht/40+   Channel   9 : 2452      MHz 11g ht/40-
Channel   2 : 2417      MHz 11b          Channel  10 : 2457      MHz 11b        
Channel   2 : 2417      MHz 11g          Channel  10 : 2457      MHz 11g        
Channel   2 : 2417      MHz 11g ht/20    Channel  10 : 2457      MHz 11g ht/20  
Channel   2 : 2417      MHz 11g ht/40+   Channel  10 : 2457      MHz 11g ht/40-
Channel   3 : 2422      MHz 11b          Channel  11 : 2462      MHz 11b        
Channel   3 : 2422      MHz 11g          Channel  11 : 2462      MHz 11g        
Channel   3 : 2422      MHz 11g ht/20    Channel  11 : 2462      MHz 11g ht/20  
Channel   3 : 2422      MHz 11g ht/40+   Channel  11 : 2462      MHz 11g ht/40-
Channel   4 : 2427      MHz 11b          Channel  36 : 5180      MHz 11a        
Channel   4 : 2427      MHz 11g          Channel  36 : 5180      MHz 11a ht/20  
Channel   4 : 2427      MHz 11g ht/20    Channel  40 : 5200      MHz 11a        
Channel   4 : 2427      MHz 11g ht/40+   Channel  40 : 5200      MHz 11a ht/20  
Channel   5 : 2432      MHz 11b          Channel  40 : 5200      MHz 11a ht/40+
Channel   5 : 2432      MHz 11g          Channel  44 : 5220      MHz 11a        
Channel   5 : 2432      MHz 11g ht/20    Channel  44 : 5220      MHz 11a ht/20  
Channel   5 : 2432      MHz 11g ht/40+   Channel  44 : 5220      MHz 11a ht/40-
Channel   5 : 2432      MHz 11g ht/40-   Channel  48 : 5240      MHz 11a        
Channel   6 : 2437      MHz 11b          Channel  48 : 5240      MHz 11a ht/20  
Channel   6 : 2437      MHz 11g          Channel 149 : 5745      MHz 11a        
Channel   6 : 2437      MHz 11g ht/20    Channel 149 : 5745      MHz 11a ht/20  
Channel   6 : 2437      MHz 11g ht/40+   Channel 149 : 5745      MHz 11a ht/40+
Channel   6 : 2437      MHz 11g ht/40-   Channel 153 : 5765      MHz 11a        
Channel   7 : 2442      MHz 11b          Channel 153 : 5765      MHz 11a ht/20  
Channel   7 : 2442      MHz 11g          Channel 153 : 5765      MHz 11a ht/40-
Channel   7 : 2442      MHz 11g ht/20    Channel 157 : 5785      MHz 11a        
Channel   7 : 2442      MHz 11g ht/40+   Channel 157 : 5785      MHz 11a ht/20  
Channel   7 : 2442      MHz 11g ht/40-   Channel 157 : 5785      MHz 11a ht/40+
Channel   8 : 2447      MHz 11b          Channel 161 : 5805      MHz 11a        
Channel   8 : 2447      MHz 11g          Channel 161 : 5805      MHz 11a ht/20  
Channel   8 : 2447      MHz 11g ht/20    Channel 161 : 5805      MHz 11a ht/40-
Channel   8 : 2447      MHz 11g ht/40-   Channel 165 : 5825*     MHz 11a
```

Can you show me your ifconfig -v wlan0 list channel output?

Thanks


----------



## Phishfry (Jun 6, 2017)

I see ht40+ and ht40- so this is N mode. WME is also enabled so you should be good to go.
I am away for vacation and don't have access to my APU.

https://forum.pfsense.org/index.php?topic=87516.msg480896#msg480896


----------



## unknownuser (Jun 6, 2017)

Phishfry said:


> I see ht40+ and ht40- so this is N mode. WME is also enabled so you should be good to go.
> I am away for vacation and don't have access to my APU.
> 
> https://forum.pfsense.org/index.php?topic=87516.msg480896#msg480896



Thanks for the help man. Much appreciated and enjoy your much needed vacations.


----------



## Phishfry (Jun 11, 2017)

Attached are both my access point channel scans on FreeBSD 11 Release-
AR9280 from SR71E and AR9380 from AR5BXB112


----------

