Debian – How to set up wifi hotspot with 802.11n mode

debiannetworkingnetworkmanagerwifiwifi-hotspot

I have two computers running Ubuntu 14.04 (ok, one is actually Mint 17.1, but that's based on Ubuntu 14.04), and I am looking to use one as a wi-fi hotspot for the other. Both computers have identical USB Wi-fi dongles supporting dual-band (2.4/5 GHz) 802.11a/b/g/n modes. Although I have managed to set up a hotspot, it seems limited to 54 Mbps in either g or a mode, even though the dongles are capable of 300 Mbps in n mode. It is important to me to unlock the full speed of the devices.

What I have tried:

On Computer 1 (which creates a hotspot):

Open NetworkConnections, click Add, select Wi-Fi, click Create.
Then fill in the SSID, set Mode to Ad-hoc, leave Band on Automatic (although I have also tried limiting to "A (5 GHz)" or "B/G (2.4 GHz)", chosse Device MAC address. In Wi-Fi Security tab, I select "WPA & WPA2 Personal", and enter a password. in "IPv4 Settings" tab, I select Method "Shared to other computers". Click Save, and connect to it.

On Computer 2 (joins the hotspot):

I cannot use a GUI so I set it up with nmcli.

# nmcli dev wifi connect SSID password <password>

and I'm off to the races!

… except I lose the race because nmcli dev wifi reports the rate as 54 Mb/s, and scp on a large file reports ~3.3 MB/s, which corresponds to 54 Mb/s at half-duplex.


I have also tried setting up the hotspot with ap-hotspot after disabling NetworkManager on Computer 1, and I have also tried using wicd instead of Network Manager on Computer 2, but no combination seems to give me N mode/speed greater than 54 Mbps.


Some debug output

Computer 1

user@computer1:$ iwconfig wlan1
wlan1     IEEE 802.11abgn  ESSID:"MY_SSID"  
          Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: AE:68:F9:9C:EA:00   
          Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
user@computer1:$ nm-tool

NetworkManager Tool

State: connected (global)

- Device: wlan1  [MY_SSID-hotspot] --------------------------------------------
  Type:              802.11 WiFi
  Driver:            rt2800usb
  State:             connected
  Default:           no
  HW Address:        7C:DD:90:79:F2:89

  Capabilities:

  Wireless Properties
    WEP Encryption:  yes
    WPA Encryption:  yes
    WPA2 Encryption: yes

  Wireless Access Points (* = current AP)
    *MY_SSID:       Ad-Hoc, AE:68:F9:9C:EA:00, Freq 2412 MHz, Rate 54 Mb/s, Strength 100 WPA2
    <snip other networks, all reporting Rate 54 Mb/s>

  IPv4 Settings:
    Address:         10.42.0.1
    Prefix:          24 (255.255.255.0)
    Gateway:         0.0.0.0

Computer 2

user@computer2:$ iwconfig wlan1
wlan1     IEEE 802.11abgn  ESSID:"MY_SSID"  
          Mode:Ad-Hoc  Frequency:2.412 GHz  Cell: AE:68:F9:9C:EA:00   
          Tx-Power=20 dBm   
          Retry  long limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
user@computer2:$ nm-tool

NetworkManager Tool

State: connected (global)

- Device: wlan1  [MY_SSID] ----------------------------------------------------
  Type:              802.11 WiFi
  Driver:            rt2800usb
  State:             connected
  Default:           yes
  HW Address:        7C:DD:90:6C:2B:23

  Capabilities:

  Wireless Properties
    WEP Encryption:  yes
    WPA Encryption:  yes
    WPA2 Encryption: yes

  Wireless Access Points (* = current AP)
    *MY_SSID:       Ad-Hoc, AE:68:F9:9C:EA:00, Freq 2412 MHz, Rate 54 Mb/s, Strength 100 WPA2

  IPv4 Settings:
    Address:         10.42.0.88
    Prefix:          24 (255.255.255.0)
    Gateway:         10.42.0.1

    DNS:             10.42.0.1

Best Answer

To have 802.11n mode, in your /etc/hostapd.conf you need the directives:

hw_mode=g
ieee80211n=1
ht_capab=[SHORT-GI-40][HT40+][HT40-][DSSS_CCK-40]

So basically, you need support for g mode, with 802.11n extensions, and the ht_capab directive is for enabling support for 40MHz. If your chipset does not support 40MHz bandwidth, comment it out.

Beware that for 40MHz bandwidth, you would better look out which channel you are using. I would suggest using a program to listen to and analyse the use of the wifi spectrum in the neighbourhood.

You can also run a command line to scan the networks being used:

sudo iwlist wlan0 scan

You can also try to put in /etc/hostapd.conf

wme_enabled=1

If it is supported, it will be faster, however some chipsets have stability problems with this last directive.

From https://en.wikipedia.org/wiki/Wireless_Multimedia_Extensions

"Wireless Multimedia Extensions (WME), also known as Wi-Fi Multimedia (WMM), is a Wi-Fi Alliance interoperability certification, based on the IEEE 802.11e standard. It provides basic Quality of service (QoS) features to IEEE 802.11 networks. WMM prioritizes traffic according to four Access Categories (AC) - voice, video, best effort, and background."

Related Question