So I set up a hotspot using hostapd, isc-dhcp-server and MASQUERADING. The hotspot works and I can access Internet.


The connection speed is too slow.

When I connect to my hotspot (via android 4.1, Snapdragon S3), I see a connection speed of 65mbps, which drops down to 1mbps in seconds.

I know this isn't a hardware issue as I can easily get 24mbps (54mbps link) out of my ethernet connection on Windows (via connectify).



mon.wlan0  IEEE 802.11bgn  Mode:Monitor  Tx-Power=19 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on

eth0      no wireless extensions.

lo        no wireless extensions.

wlan0     IEEE 802.11bgn  Mode:Master  Tx-Power=19 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off

iw list:

Wiphy phy0
    Band 1:
        Capabilities: 0x70
            Static SM Power Save
            RX Greenfield
            RX HT20 SGI
            RX HT40 SGI
            No RX STBC
            Max AMSDU length: 3839 bytes
            No DSSS/CCK HT40
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 8 usec (0x06)
        HT TX/RX MCS rate indexes supported: 0-7
            * 2412 MHz [1] (19.0 dBm)
            * 2417 MHz [2] (19.0 dBm)
            * 2422 MHz [3] (19.0 dBm)
            * 2427 MHz [4] (19.0 dBm)
            * 2432 MHz [5] (19.0 dBm)
            * 2437 MHz [6] (19.0 dBm)
            * 2442 MHz [7] (19.0 dBm)
            * 2447 MHz [8] (19.0 dBm)
            * 2452 MHz [9] (19.0 dBm)
            * 2457 MHz [10] (19.0 dBm)
            * 2462 MHz [11] (19.0 dBm)
            * 2467 MHz [12] (19.0 dBm) (passive scanning, no IBSS)
            * 2472 MHz [13] (19.0 dBm) (passive scanning, no IBSS)
            * 2484 MHz [14] (disabled)
        Bitrates (non-HT):
            * 1.0 Mbps
            * 2.0 Mbps (short preamble supported)
            * 5.5 Mbps (short preamble supported)
            * 11.0 Mbps (short preamble supported)
            * 6.0 Mbps
            * 9.0 Mbps
            * 12.0 Mbps
            * 18.0 Mbps
            * 24.0 Mbps
            * 36.0 Mbps
            * 48.0 Mbps
            * 54.0 Mbps

lspci -v:

0a:00.0 Network controller: Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter (rev 01)
    Subsystem: Hewlett-Packard Company Device 1795
    Flags: bus master, fast devsel, latency 0, IRQ 19
    Memory at d4500000 (64-bit, non-prefetchable) [size=16K]
    Capabilities: [40] Power Management version 3
    Capabilities: [58] Vendor Specific Information: Len=78 <?>
    Capabilities: [48] MSI: Enable- Count=1/1 Maskable- 64bit+
    Capabilities: [d0] Express Endpoint, MSI 00
    Capabilities: [100] Advanced Error Reporting
    Capabilities: [13c] Virtual Channel
    Capabilities: [160] Device Serial Number <removed>
    Capabilities: [16c] Power Budgeting <?>
    Kernel driver in use: bcma-pci-bridge

0b:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07)
    Subsystem: Hewlett-Packard Company Device 1818
    Flags: bus master, fast devsel, latency 0, IRQ 43
    I/O ports at 2000 [size=256]
    Memory at d4404000 (64-bit, prefetchable) [size=4K]
    Memory at d4400000 (64-bit, prefetchable) [size=16K]
    Capabilities: [40] Power Management version 3
    Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+
    Capabilities: [70] Express Endpoint, MSI 01
    Capabilities: [b0] MSI-X: Enable- Count=4 Masked-
    Capabilities: [d0] Vital Product Data
    Capabilities: [100] Advanced Error Reporting
    Capabilities: [140] Virtual Channel
    Capabilities: [160] Device Serial Number <removed>
    Kernel driver in use: r8169

Ubuntu Release:

Linux pr3d4tOr 3.11.0-17-generic #31-Ubuntu SMP Mon Feb 3 21:52:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

What I have tried:

  • Transmission power:

    prakhar@pr3d4tOr:~$ sudo iwconfig mon.wlan0 txpower 24

  • Bit rate:

    prakhar@pr3d4tOr:~$ sudo iwconfig mon.wlan0 rate auto

  • Disable power management:

    prakhar@pr3d4tOr:~$ sudo iwconfig mon.wlan0 power off Error for wireless request "Set Power Management" (8B2C) : SET failed on device mon.wlan0 ; Invalid argument.

I tried the above for wlan0 as well. No results. Can anyone guide as to what might be the problem?


Ok, so I figured out the problem.

It appears that the current driver is use (bcma-pci-bridge) doesn't fully support my Wireless Card (Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter). If I let my computer go to sleep and wake it up again, the Wi-Fi card stays in low power mode, hence the 1mbps speed.

On boot up, the sppeds are correctly varying from 1mbps to 54mbps.

The other alternative, bcmwl-kernel-source, while giving optimum wireless performance, doesn't support AP mode at all.

I haven't been able to find any other drivers.

Hope this helps somebody.

EDIT: Switching to brcmsmac adds AP mode.

prakhar@aS4v4g3wOrld:~$ iw list

    Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor
    software interface modes (can always be added):
         * AP/VLAN
         * monitor

(Partial output).

Head to this article to install.

  • I don't know if this comment could help, few years ago I changed my linux laptop for a macbook, and now I'm a bit "rusty". Anyway, in some circumstances, it was possible dynamically unload (rmmod) and load (modprobe) linux drivers. Maybe this could help to reset your driver configuration and avoid to reboot your device. – freedev Aug 2 '14 at 21:51

802.11n Speeds on BCM4313

I created an Access Point hotspot using the following hostapd configuration:

#####Basic Settings########################
#sets the wifi interface to use, is wlan0 in most cases
#driver to use, nl80211 works in most cases
#Access Point name

#####Channel and Mode Settings#############
# Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g,
# ad = IEEE 802.11ad (60 GHz); a/g options are used with IEEE 802.11n, too, to
# specify band)
# Default: IEEE 802.11b
# WiFi Channel:

##### IEEE 802.11n related configuration ##
#WMM needs to be enabled for full HT functionality
# ieee80211n: Whether IEEE 802.11n (HT) is enabled
# 0 = disabled (default)
# 1 = enabled
# Note: You will also need to enable WMM for full HT functionality.
# ht_capab: HT capabilities (list of flags)
# LDPC coding capability: [LDPC] = supported
# Supported channel width set: [HT40-] = both 20 MHz and 40 MHz with secondary
#   channel below the primary channel; [HT40+] = both 20 MHz and 40 MHz
#   with secondary channel below the primary channel
#   (20 MHz only if neither is set)
#   Note: There are limits on which channels can be used with HT40- and
#   HT40+. Following table shows the channels that may be available for
#   HT40- and HT40+ use per IEEE 802.11n Annex J:
#   freq        HT40-       HT40+
#   2.4 GHz     5-13        1-7 (1-9 in Europe/Japan)
#   5 GHz       40,48,56,64 36,44,52,60
#   (depending on the location, not all of these channels may be available
#   for use)
#   Please note that 40 MHz channels may switch their primary and secondary
#   channels if needed or creation of 40 MHz channel maybe rejected based
#   on overlapping BSSes. These changes are done automatically when hostapd
#   is setting up the 40 MHz channel.
# Spatial Multiplexing (SM) Power Save: [SMPS-STATIC] or [SMPS-DYNAMIC]
#   (SMPS disabled if neither is set)
# HT-greenfield: [GF] (disabled if not set)
# Short GI for 20 MHz: [SHORT-GI-20] (disabled if not set)
# Short GI for 40 MHz: [SHORT-GI-40] (disabled if not set)
# Tx STBC: [TX-STBC] (disabled if not set)
# Rx STBC: [RX-STBC1] (one spatial stream), [RX-STBC12] (one or two spatial
#   streams), or [RX-STBC123] (one, two, or three spatial streams); Rx STBC
#   disabled if none of these set
# HT-delayed Block Ack: [DELAYED-BA] (disabled if not set)
# Maximum A-MSDU length: [MAX-AMSDU-7935] for 7935 octets (3839 octets if not
#   set)
# DSSS/CCK Mode in 40 MHz: [DSSS_CCK-40] = allowed (not allowed if not set)
# PSMP support: [PSMP] (disabled if not set)
# L-SIG TXOP protection support: [LSIG-TXOP-PROT] (disabled if not set)
# Require stations to support HT PHY (reject association if they do not)

#####Security and Authentication###########
#macaddr_acl sets options for mac address filtering. 0 means "accept unless in deny list"
#Sets authentication algorithm
#1 - only open system authentication
#2 - both open system authentication and shared key authentication
#setting ignore_broadcast_ssid to 1 will disable the broadcasting of ssid

#####Sets WPA and WPA2 authentication######
#wpa option sets which wpa implementation to use
#1 - wpa only
#2 - wpa2 only
#3 - both
#sets WPA Password required by the clients to authenticate themselves on the network
#sets wpa key management
#sets encryption used by WPA2

My system is Ubuntu 12.04.4 with linux-generic-lts-saucy kernel (Saucy's 3.11 kernel backported to Ubuntu 12.04LTS). I used brcmsmac wireless driver, which got AP mode support from 3.10 kernel onwards. I managed to get 72Mbps 802.11n link speed on 2.4GHz band with 20MHz channel width. But, like in your case, actual transfer speed is less than 1MBps, even for FTP transfers.
As BCM4313 can't operate on 5GHz, we can't get channel-bonding n-mode speeds anyway. Our best bet is to get 40MHz channel width (HT40 mode) in 2.4GHz band. The problem is that brcmsmac doesn't properly support 40MHz mode in 2.4GHz band, atleast for BCM4313. There's no DSSS/CCK mode support either. I hope the driver improves in newer kernels. When Ubuntu 14.04 Trusty Tahr is released, I'll try this again with its 3.13 kernel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.