Dienstag, 9. September 2014

TP-Link Archer C5 with OpenWRT

Since I couldn't find any real information about the C5 running OpenWRT in English or German apart from some commits to OpenWRT enabling the support.


Some infos about the router:

I bought the TP-Link Archer C5 AC1200 WLAN Dual Band Gigabit Router (802.11b/g/n/ac, 1200Mbit/s, 4x LAN, 1x WAN, 2x USB 2.0) from Amazon Warehouse Deals for 67€
Right now it is the cheapest AC router with OpenWRT support I could find apart from one without Gigabit Ethernet.
The hardware of the C5 V1.2 is nearly identical to the C7 V2. Apart from the claimed max speed, I couldn't find a difference.

Installing OpenWRT on the Archer C5:
I just followed the instructions for the C7 and used the provided C5 .bin file instead of the C7 one.
That's it. Everything C5 specific works out of the box, including the 5Ghz WiFi.

Configuring WiFi:
I had some minor problems setting up the wifi through LuCI.
1. Because I saved the router password in Chrome, my WPA2-Key was overwritten with the password every time I changed something. Deleting the password in Chrome solved it for now.
2. After I chose the Auto channel, the 5GHz wifi wouldn't start. Even changing the channel didn't help. I had to edit the channel in the config file by hand.

Country Code:
Because of some laws the country selection isn't working by default.
To unlock the allowed channels for your country, you have to use the reghack.
This is rather important for my case because there are many wifi networks around, but none of them are channel 12-14 and the one on channel 11 is rather weak.
Afterwards I changed the country to world to test what the router is capable of:
2.4GHz: 25 dBm /   316 mW  Choosing anything above 25 dBm results in 25 dBm
5GHz:    30 dBm / 1000 mW which is also the maximum allowed in Germany at some frequencies

Speed:
Because I'm rather limited by my other wifi products right now, I can't really test the max speed, but I can compare it with my previous router, the TL-WR1042ND with some huge 8dBi antennas:

Sony Xperia Z1 Compact and Asus Nexus 7 (2013) LTE : I could finally replace the top results in the Speedtest.net App which I got over LTE (88Mbit/s) with WiFi results (98Mbit/s). With my old router, I only got around 50-60Mbit/s. iperf results are above 100Mbit/s as well

TP-Link TL-WN821N Netzwerk W-LAN USB Adapter 300 MBit: At around 150Mbit/s it should be around the same as before.

HP Chromebook 14: ~200Mbit/s

These results are from a quick test I did between the various devices and 2 Computers connected over Gbit Lan (which provided around the full 1Gbit/s of course). I will have to do further testing when I have some time since the testing environment wasn't constant across the tests at all and the iperf values aren't really accurate because I didn't write them down or save them, so they are just what I remember.

Range:
The range is a bit better on the 2.4Ghz band than before, but not really much. The 5GHz range is nearly as good as the 2.4GHz range in my flat. But only after I fixed the country setting and set the TX power to 30dBm.

So in the end I'm quite happy with the router so far. Right now I don't have time to do more stuff with it, but if you have any questions, then don't hesitate to ask me.

20 Kommentare:

  1. Can you tell me how exactly did you get the 5GHz to work. I've been trying for hours now without succes..

    AntwortenLöschen
    Antworten
    1. Take a look at http://wiki.openwrt.org/doc/uci/wireless
      edit /etc/config/wireless
      Mine looks something like this:

      config wifi-device 'radio0'
      option type 'mac80211'
      option path 'pci0000:01/0000:01:00.0'
      option disabled '0'
      option htmode 'HT40'
      option noscan '1'
      option channel '108'
      ...

      Löschen
  2. Thanks! After trying a lot of things I got it to work:)

    AntwortenLöschen
  3. And what was the solution? :) I can't get fire it up :(

    AntwortenLöschen
  4. What I did is rebuild the config file. After that enable the wlan0. That's what worked for me.

    http://wiki.openwrt.org/doc/uci/wireless#regenerate.configuration

    AntwortenLöschen
  5. I also downloaded the ath10k driver. You do this by using these commands in UCI:

    opkg update
    opkg install kmod-ath10k

    By doing so I'm able to configure my wlan settings in LUCI

    AntwortenLöschen
  6. It seems there is a general problem. Perhaps we should open a bug in Openwrt/LUCI. I had hoped it was just something they would fix for the final release of Barrier Breaker. But since you guys still have that problem (and I assume you tried the final release and not an RC like I did), it doesn't seem to be fixed.

    AntwortenLöschen
  7. Thanks guys, it just started for me as well.
    And yes, Martin, current stable release (Barrier Braker) doesn't include Luci interface for 5Ghz, but it's in the trunk, so that's why it can downloaded.
    Unfortunately I couldn't tried out so far. Maybe tonight.

    1. And why did you set HT40 for htmode ?
    2. Currently I don't have any AC capable device either. So shall I go for the HT40 as well? Will this provide n-capable connection on 5Ghz?
    3. you've chosen channel 108 : isn't it a problem that DFS isn't used (if the radio set to World)

    (Sorry for these questions, but I feel really confused about this radio channels :) )

    Ps:
    And I don't know if you know this, but here's a full openwrt build with lots of stuff in it (a Hungarian guy is developing it) :
    - "official" page (in Hungarian) : http://logout.hu/bejegyzes/suste/openwrt_barrier_breaker_14_07_sajat_verzio.html
    (you can make comment after registering to the forum)
    - firmwares: http://suste.besaba.com/Openwrt_Barrier_Breaker/
    - included packages: http://suste.besaba.com/Openwrt_Barrier_Breaker/10--16MB_telepitett%20_csomagok.txt

    Unfortunately the reghack isn't included yet, AC patch available separately, and there's 2 small config bugs in this release. I already told the guy about them, it will be included in the next one :)
    But it's pretty awesome, since all the necessary packages already included in the rom, and it won't take up space in the /overly !!! (and they are preconfigured)
    So, I'm not using any swap partition! I have set up the following services : vsftpd, samba,
    minidlna, transmission (with web-ui), wake-on-lan remotely (not from the router) (with the help of 'ip' package). (an old 500GB USB2 hdd is on it which has an external power supply as well.)
    The guest network capability is interesting (to separate rest of the WIFI users from my own small network), so I'll try to set it up.

    AntwortenLöschen
  8. And I can't start the 5Ghz part in VHT80 mode!!! It only works in VHT40 !
    Here's how the iwinfo look like, when it's not working:

    wlan0 ESSID: unknown
    Access Point: 00:00:00:00:00:00
    Mode: Client Channel: unknown (unknown)
    Tx-Power: 30 dBm Link Quality: unknown/70
    Signal: unknown Noise: -45 dBm
    Bit Rate: unknown
    Encryption: unknown
    Type: nl80211 HW Mode(s): 802.11nac
    Hardware: 168C:003C 0000:0000 [Generic MAC80211]
    TX power offset: unknown
    Frequency offset: unknown
    Supports VAPs: yes PHY name: phy0

    AntwortenLöschen
  9. These are the settings on my C5 for the 5Ghz. I'm running the latest Chaos Calmer r43103 snapshot. Everything works fine for me.

    config wifi-device 'radio0'
    option type 'mac80211'
    option hwmode '11a'
    option path 'pci0000:01/0000:01:00.0'
    option htmode 'VHT80'
    option channel '64'
    option txpower '23'
    option country 'US'
    option disabled '0'

    config wifi-iface
    option device 'radio0'
    option network 'lan'
    option mode 'ap'
    option encryption 'psk'
    option key
    option disabled '0'
    option ssid

    AntwortenLöschen
    Antworten
    1. at least for me, the above stopped working in Chaos Calmer r43103 when I used reghack - I have a feeling that it'll work in VHT80 in barrier breaker as well, but within limits of non-reghacked power :-(

      Löschen
    2. Thank you for the tip!!! That was the problem for me as well!!!
      After I put back the original 2 modules , it started working in VHT80 !

      Only drawback is this in this way:
      - there's no 12-13 channel in 2.4Ghz
      - the max transit power is 17dbm in 5Ghz

      So, this binary reghack doesn't work well with these modules in this stable relase.
      But! Here's a comment on this page: http://blog.michael.kuron-germany.de/2013/08/openwrt-on-tp-link-tl-wdr3600-uncapping-wifi/comment-page-1/
      "If you build your own OpenWrt you can edit the kernel .config before running make:

      echo “CONFIG_ATH_USER_REGD=y” >> .config

      The compile option is discussed at https://forum.openwrt.org/viewtopic.php?id=35828 and some other places too.

      Now when you run make it will not lock the Regulatory Domain to US and you will have available all the channels allowed in your locale. Unlike the reghack patch this doesn’t allow you to assign illegal channels or higher transmission power levels – it just sets the hardware to work as intended/advertised. I did this for my TL-WDR3600 v1 and now radio0 works on channel 13 and I have the channel to myself as everybody nearby is on 1, 6 or 11."

      I told Suste about this, maybe he can put this in in his next firmware.

      Löschen
    3. I doubt the devices I have here are capable of HT80, so I will stay with HT40 for now. Right now I'm completely satisfied with my wifi.
      The next router will probably be one with 10 Gigabit lan or something. ~120MB/s just isn't enough for the SSD in my NAS/Mediacenter (Baytrail-D J1800). So it will be a few more years ;)

      Löschen
    4. (anonym from before here)
      Ok, confirmed that it is indeed caused by the reghack. If you want to fix it, change following line in reghack:
      struct ieee80211_reg_rule r5 = REG_RULE(5140, 5860, 40, 0, 30, 0);
      to
      struct ieee80211_reg_rule r5 = REG_RULE(5140, 5860, 160, 0, 30, 0);

      Alternatively (if you do not have any linux cross-compile environment around like me), run reghack and look for 004E6E20 00596AA0 009C40 in the resulting modules; and change the last DWORD to 00027100

      Löschen
  10. Yusaku: the search thing must be: "004E6E20 00596AA0 00009C40" right? (You left off 2 0-s from the beginning of the third)
    And shall we change ALL of the entries of it in those 2 files? (in ath.ko it appers 4 times, in cfg80211.ko 3 times)

    Thanks for the hint!!!!

    AntwortenLöschen
    Antworten
    1. Yes, I missed two zeroes there, sorry. All of the occurrences have to be changed, the count sounds correct.

      Löschen
    2. Official reghack got updated, so all should work now correctly.

      Löschen
  11. Thanks for the info! I'll try it later today.
    Btw, the patched reghacked modules are working fine, Thanks! :)

    AntwortenLöschen
  12. Thanks, the modded regchack is working fine as well! :)
    However, sometimes (not every reboot) the reported noise level by iwinfo of the 5GHz radio is pretty high: "Noise: -49 dBm"
    Can it be just a reporting bug or something else?
    You can try it out when you restart the network, and it sometimes just happens:
    /etc/init.d/network restart

    As far as I remember I haven't experienced this with the unhacked modules.

    AntwortenLöschen
    Antworten
    1. The hack really just changes regulatory rules, so it is not directly responsible.

      Potential reasons:
      1) you set the transmit power so high, that it overwhelms the receiver (if you set it to 1000mW and do not have end devices capable of also transmitting @1W; not only will your neighbors hate you, but the signal will be bad for you as well)
      2) someone else started transmitting at the channels around you

      In any case, try to tweak channels and transmit power to get as good s/n ratio as possible - that's the only recommendation I can give you :)

      Löschen