Philipp's Computing Blog

Success is about speed and efficiency

OpenWrt on a TP-Link TL-WDR4300 Router

The TL-WDR4300 is an up-to-date router of the Chinese network equipment producer TP-Link.

CPU Flash RAM Network WAN USB Serial JTag
AR9344 8MB 128MB 4x1 GigE 1x1 GigE x2 v2.0 Yes Yes

I'm replacing my TP-Link TL-WR1043ND with that newer and faster model. Most of the hints and tricks for OpenWrt on the TL-WR1043ND given on that page still work for this model.

OpenWrt Firmware

Switch Setup

Ports of the switch:

port no in swconfig configuration → port 0 port 1 port 2 port 3 port 4 port 5
name on the device's case / function → none / internal: CPU "Internet" / WAN "1" "2" "3" "4"

As of the OpenWrt version I'm using currently (uname -a: Linux shark 3.6.10 #1 Thu Dec 13 00:51:37 PST 2012 mips GNU/Linux), only VLAN IDs up to 128 seem to work (no 4k support yet?!). It also doesn't help to set option enable_vlan4k '1' in the to the switch config settings in /etc/config/network.

The output of swconfig dev eth0 help also gives a hint that the switch currently only supports vlans up to 128:

switch0: eth0(Atheros AR8327), ports: 7 (cpu @ 0), vlans: 128
     --switch
        Attribute 1 (int): enable_vlan (Enable VLAN mode)
        Attribute 2 (none): reset_mibs (Reset all MIB counters)
        Attribute 3 (none): apply (Activate changes in the hardware)
        Attribute 4 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (int): vid (VLAN ID (0-4094))
        Attribute 2 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (none): reset_mib (Reset single port MIB counters)
        Attribute 2 (string): mib (Get port's MIB counters)
        Attribute 3 (int): pvid (Primary VLAN ID)
        Attribute 4 (string): link (Get port link information)

Here is the detailed swconfig output of a working setup I'm using (vlan 2 and vlan 102 configured): swconfig dev eth0 show output.

One thing to note is that the switch supports configuring external trunk ports! I'm using it.

The switch supports port mirroring. The functionality is also built-in to the driver. It can be configured in /etc/config/network in the switch section by setting the following properties: enable_mirror_rx, enable_mirror_tx, mirror_monitor_port, and mirror_source_port.

Tweaks

Add the following lines before the exit 0 statement in /etc/rc.local:

ifconfig eth0 txqueuelen 10500
ifconfig wlan0 txqueuelen 7935 mtu 1328
ifconfig wlan1 txqueuelen 7935 mtu 1328

and change /etc/sysctl.conf:

vm.min_free_kbytes=4096
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.core.netdev_max_backlog = 30000

Found here.

Jumbo Frames

The built-in switch is a Qualcomm Atheros AR8327N 7-port Low-power Managed/Layer3 Gigabit Switch with Hardware NAT. It supports jumbo frames in general but only after this change on 2013-12-15 the support for large packets was enabled by default.

OpenWrt Bugs

Fixes (without bug reports):

Resources