Solved Wifi AP too slow

Nicola Mingotti

Well-Known Member

Reaction score: 200
Messages: 494

Hi guys, I have this problem I can not sort out, I hope you can give me some ideas.

The story is I made an Wireless Access point in FreeBSD-11.1 running in an BeagleBone Black.
My wifi adapter is an Alfa AWUS036HN, recognized as "run0", 802.11g. [n not available]
The thing works, the olny problem is the maxium speed I can reach is ~ 100KByte/s .
-] I was expecting my speed to be around ten times that.
-] All speed test have been made transferring via sftp a large file from the access point to a client.

-] I tried to change channels, there is some variation but nothing great (about +/- 20KBytes/s).
-] I tried to remove hostapd, free network=> no significant speed changes.
*] The only thing I could still remove is the bridge ... still I have not tried that. I would like to keep the bridge if it is possible.

Here goes my full configuration. Please notice that I use abuntantly "rc.local" because
I find it a lot easier to discover the way to configure things on the shell and then stack the
successull commands sequence into "rc.local".

I don't write down the "dhcp" configuration, but I add the "ipfw" conf. It may be relevant.
Since my network is so slow it tried to avoid that Android updates suddenly vampire
the network and impede all kind of work => I put about all expendable clients of the AP in a restricted speed pipe.

Please ignore comments in Italian.

---- /etc/rc.conf ------
# per il controllo del traffico

# ---- per la criptazione del wifi

# -] config hostname
# hostname="wifi-tel-ap1"

# -] per il firewall

# -] per la data da tenere aggiornata

----- /etc/rc.local ----
/sbin/ifconfig bridge create
/sbin/ifconfig bridge0 inet
/sbin/ifconfig bridge0 addm cpsw0 up
/sbin/ifconfig cpsw0 up

ifconfig wlan0 create wlandev run0 wlanmode hostap
ifconfig bridge0 addm wlan0
ifconfig wlan0 ssid NicolaTemporaneo mode 11g channel 8
ifconfig wlan0 up

route add default
/usr/local/sbin/dhcpd bridge0 -cf /etc/dhcpd.conf

----- /etc/hostapd.conf ----


# Log all "informational messages" and above to syslog.

----- /etc/ipfw.rules ----

# Flush out the list before we begin.
ipfw -q -f flush
eth0="cpsw0"       # la porta ethernet

# No restrictions on Loopback Interface
ipfw add 00010 allow all from any to any via lo0

# dhcp non si espanda fuori dalla rete wireless
ipfw add 00020 deny udp from any 68 to any 67 in via $eth0    # DHCP_DISCOVER
ipfw add 00030 deny udp from any 67 to any 68 out via $eth0   # DHCP_OFFER

# --- limitazione del traffico ------
ipfw add 00040 pipe 2 ip from any to not $PROTETTI out
ipfw pipe 2 config bw 30KByte/s queue 50KBytes

# tutto il resto passa
ipfw add 00999 allow all from any to any
Nicola Mingotti

Nicola Mingotti

Well-Known Member

Reaction score: 200
Messages: 494

I made some more experiments:

-] I substituted my AP device with a Alfa AWUS036NEH (it uses the same driver "run")
=> No differences.

-] I tried to go near to the AP during data transfer
=> No appreciable differences

*] I made some test for MTU and i discovered something interesting.
Here i ping from a client the AP:
#> ping -f -c 200 -s 100    => 0% packet loss
#> ping -f -c 200 -s 1024  => 60% packet loss !!

Here I am moving into the wild, I don't know well this topic, I tried to chage the MTU
of my bridge to "156". The consequence was that now the AP was slow in comunicating via Ethernet to the other machienes (expected, the other comunicate at 1500 MTU) and I had difficulties in connecting to it on the Wireless networks.

In "/var/log/messages" i found:
Feb 19 09:20:25 wifi-ap1 kernel: run0: 11g rates: 1Mbps 2Mbps 5.5Mbps
  11Mbps 6Mbps 9Mbps 12Mbps
  18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
So i tried to add
ifconfig wlan0 roam:rate 54Mb/s
=> again not interesting speed differences.


Active Member

Reaction score: 56
Messages: 141

I have no great answers but here's a few things to try:

- establish a baseline using either benchmarks/iperf or benchmarks/iperf3 for your benchmarking to keep things simple: specifically disabling dummynet & ipfw completely, and a default MTU
- then see if an MTU of around 1400 makes any difference
- report back and we'll now know if we are dealing with firewall config issues or something closer to the wire
- if you can, repeat the benchmark with the wired ethernet interface of the BB as a baseline

running sudo wlandebug debug+scan+assoc+auth+rate+power may give you more information, or it may just overwhelm you with info.
Nicola Mingotti

Nicola Mingotti

Well-Known Member

Reaction score: 200
Messages: 494

Thank you for suggestions dch , I just got it working :)
I don't know these iperf commands, I will put them
in my notes and study them as soon as possible.\

It has been a real Odiessey !

Now I can transfer files at about 2.1 MByte/s !
I think I could still almost double this but enough is enough;)

For some reason some default config in "run" driver was limiting
the speed to 1Mbit/s. The key was the command
ifconfig wlan0 roam:rate 54Mb/s
but ...
That does not work by default, a manual load of a module was necessary.
kldload wlan_amrr.
And I was not able to see the error message at the beginning.

I disabled all the things in "/etc/rc.conf" re-did all the configurations from shell step by step, in this way I found interesting messages and suggestions.

I higly recomend to everybody who find themselves in network troubles to
disable almost all from "/etc/rc.conf" and do all step by step from the shell !

Thank a lot to the people who wrote the "ifconfig" man. There i found these
jewels I want to share with you all.
#> ifconfig wlan0 list sta
#> ifconfig wlan0 list roam



Reaction score: 899
Messages: 1,295

I experienced the very same with the rtwn(4) driver. In bridged hostap mode I saw over wireless connections the transfer rate of 100 kBbyte/s. Here I have an USB/WLAN dongle with the RTL8188eu chipset, and it is a 11n adapter. If I switch it to g only, then the command which Nicola Mingotti found out, would bring it to full g-speed.

However, for n mode the actual command for full speed is different:
ifconfig wlan0 roam:rate 7

This sets the MCS index from 1 to 7 - see

In single-channel operation this increases the data rate to 72 MBit/s.
Last edited: