TP-Link WN725N v2 on Raspberry Pi at N speeds (150 Mbps).

So I managed to get the wireless nano-dongle to work on one of my Raspberry Pi’s. It’s a TP-Link WN725N version 2. It has N capabilities, and it wasn’t easy making sure I got N speeds either, more on that later.

Drivers

To get the drivers into the kernel, I used the script downloadable in this forum post:
http://www.raspberrypi.org/forums/viewtopic.php?p=479340#p479340

You might have to edit the script, basically change the part …/phpBB3/… to …/forums/…
Just run the script and reboot.

N-speeds and connecting it to your network 

Then we want to make sure we get the N-protocol up and running. The key to this lies in the security settings of the wireless, not the Raspberry Pi.
If you run

iwconfig wlan0

the output should look something like:

wlan0     IEEE 802.11bgn  ESSID:”SSID”  Nickname:”<WIFI@REALTEK>”
          Mode:Managed  Frequency:2.437 GHz  
          Bit Rate:72.2 Mb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:****-****-
          Security mode:open
          Power Management:off
          Link Quality=100/100  Signal level=100/100  

and some other things.
Here you can see I get all three, b+g+n. If it says “bg” you’re doing it wrong, given that you have a N-capable router…

To get it working, you have to only have the AES (CCMP) security ONLY, i.e. NOT TKIP, TKIP is the older security protocol, and gives you only G-speeds, i.e. 54 Mbps. So to fix this, make sure the wireless is setup with WPA(2) AES security. NOTE: this dongle only has one (1) antenna, that’s why the N-speed is 150 Mbps, you need an adapter with 2 antennae to get 300 Mbps, but then you probably need a powered USB-hub too.

Then in /etc/network/interfaces you can have (given that you have DHCP and not static IPs):

auto lo

# ethernet
iface lo inet loopback
iface eth0 inet dhcp

# The WLAN network interface
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface wlan0 inet dhcp

and then for the important part, in /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1


network={
        ssid=”YOUR_SSID”
        psk=”YOUR_PASSPHRASE”
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=CCMP
        auth_alg=OPEN
}

and then it should all be dandy. Some guides tell you to go with something else for “proto” and “pairwise” and don’t include “group”, these are the TKIP guides, giving G-speeds.

Note: If only get, ~72 Mbps, you should try to activate channel bonding, i.e. get the channel bandwidth of the wireless network (router, ap, etc) of 40 MHz, as opposed to 20 MHz (so it clumps two 20 MHz channels together). However, this can degrade the signal in crowded areas, that’s why mine says 72 Mbps.

Reboot and enjoy!

Usefull links:
TKIP vs. AES and setup : http://www.raspberrypi.org/forums/viewtopic.php?t=36081&p=517178
WPA2-PSK setup: https://coderwall.com/p/v290ta