Solved Wifi AP too slow

Nicola Mingotti

Well-Known Member

Reaction score: 141
Messages: 369

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.

Code:
---- /etc/rc.conf ------
sshd_enable="YES"
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
growfs_enable="YES"
# per il controllo del traffico
dummynet_enable="YES"

# ---- per la criptazione del wifi
hostapd_enable="YES"

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

# -] per il firewall
firewall_enable="YES"
firewall_script="/etc/ipfw.rules"

# -] per la data da tenere aggiornata
ntpd_enable="YES"
Code:
----- /etc/rc.local ----
/sbin/ifconfig bridge create
/sbin/ifconfig bridge0 inet 172.16.12.1/24
/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 172.16.12.253
/usr/local/sbin/dhcpd bridge0 -cf /etc/dhcpd.conf
Code:
----- /etc/hostapd.conf ----
nterface=wlan0
debug=1
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
ssid=NicolaTemporaneo
wpa=2
wpa_passphrase=BLABLABLA
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP

hw_mode=g
wmm_enabled=1

# Log all "informational messages" and above to syslog.
logger_syslog=-1
logger_syslog_level=2
Code:
----- /etc/ipfw.rules ----
#!/bin/sh

# 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 ------
PROTETTI="172.16.12.0/24{1,2,3,21,253}"
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
 
OP
OP
Nicola Mingotti

Nicola Mingotti

Well-Known Member

Reaction score: 141
Messages: 369

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:
Code:
#> ping -f -c 200 -s 100 172.16.12.1    => 0% packet loss
#> ping -f -c 200 -s 1024 172.16.12.1  => 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:
Code:
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.
 

dch

Active Member

Reaction score: 43
Messages: 111

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.
 
OP
OP
Nicola Mingotti

Nicola Mingotti

Well-Known Member

Reaction score: 141
Messages: 369

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
 
Top