OpenWrt Forum Archive

Topic: Switch configuration for tl-wr1043nd v2

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I got my hands on a tl-wr1043nd v2.1. This model has a different hardware and OpenWrt trunk has recently added support:
https://dev.openwrt.org/changeset/38958/trunk

This is the default switch configuration that results in eth0 (WAN port) and eth1 (LAN ports):

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'
 
config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 4'
 
config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'

Some additional informations:

$dmesg | grep Atheros
[    0.000000] SoC: Qualcomm Atheros QCA9558 rev 0
[    0.750000] switch0: Atheros AR8327 rev. 4 switch registered on ag71xx-mdio.0
[    2.570000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:00 [uid=004dd034, driver=Atheros AR8216/AR8236/AR8316]
[    2.580000] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:RGMII
[    3.140000] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:SGMII
[   10.470000] ieee80211 phy0: Atheros AR9550 Rev:0 mem=0xb8100000, irq=47

The problem now is how to separate a port into another interface (eth3?).
This was my attempt, but it did now create eth3 even it was added to some bridge sections ifname option (in /etc/config/network):

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'
 
config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3'
 
config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'

config switch_vlan
        option device 'switch0'
        option vlan '3'
        option ports '4'

Any idea how to do this?

cpu port have to be tagged without it dont work

check
# swconfig list
# swconfig dev <dev> show

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 3 4t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'

config switch_vlan
        option device 'switch0'
        option vlan '3'
        option ports '2 4t'

i hope 4 is cpu port i dont have this device

(Last edited by trismo on 12 Dec 2013, 23:28)

I got this unit recently and it seems that nothing is further from WR1043NDv1 than WR1043NDv2.

The switch configuration posted by mwarning is correct. When looking on port stats through swconfig (on my unit which runs r39276 trunk) it seems that there are two physical interfaces/switches connected to CPU by two different ports. Since each switch is implicitly identified by CPU port, no tagging is necessary as long as those phys are switching only one vlan each.

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 4'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'

Further looking gives impression that port 0 is CPU port in first switch (which is later identified by kernel as eth1) and port 6 is CPU port on second switch (which is later identified by kernel as eth0).

Given this information in order to get another vlan on let's say port 4 one should configure it this way:

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0t 1 2 3'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0t 4'

config switch_vlan
        option vlan '3'
        option device 'switch0'
        option ports '5 6'

Then the local bridge will be configured on eth1.1 and the new port should be at eth1.2

config interface 'lan1'
        option ifname 'eth1.1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

config interface 'lan2'
        option ifname 'eth1.2'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'

This gives expected configuration on my unit, but I have no means to verify it is actually working.

(Last edited by risa2000 on 17 Jan 2014, 00:49)

@risa2000: Just to be sure, does this describe the setup you are talking about?

(PORT 5 "WAN") -- [SWITCH1] -- (Port 6) -- [CPU] -- (Port 0) -- [SWITCH0] -- (Ports 1-4)
flaaabes wrote:

@risa2000: Just to be sure, does this describe the setup you are talking about?

(PORT 5 "WAN") -- [SWITCH1] -- (Port 6) -- [CPU] -- (Port 0) -- [SWITCH0] -- (Ports 1-4)

Yes. Just one note. It seems that SWITCH1 & SWITCH0 are identified (probably by driver/kernel) as eth0 and eth1 regardless how they are identified with vlan ID in network config.

So SWITCH1 ~ eth0, SWITCH0 ~ eth1.

Thanks, I had a suspicion that it could work like this, but I always was confused that both switches are referred as swith0 in default-config.

I will give my ip-tv-setup another try with this newly gained knowledge.

Has this config worked ?

I'm trying to add a second WAN ( as i did many times in 1.x versions) but i have issues with the vlans.

If someone could post the config for 2nd wan port ( 3vlan) and maybe a 4rth vlan would be great...!!

My current config is:

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3'
        option vid '1'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'
        option vid '2'

config switch_vlan
        option device 'switch0'
        option vlan '3'
        option ports '4 6'
        option vid '3'

config interface 'wan2'
        option proto 'static'
        option ifname 'eth0.3'
        option ipaddr '192.168.100.100'
        option netmask '255.255.255.0'

I've made some different switch configurations and tried to figure out what label it belongs to by checking the number of received packets on all interfaces:

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

 #eth1 (LAN 1-4)
config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 4'
 
#eth0 (WAN)
config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'
config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

#eth1.1 (LAN 2-4)
config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0t 1 2 3'

#eth1.2 (LAN 1)
config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0t 4'

#eth0 (WAN)
config switch_vlan
        option vlan '3'
        option device 'switch0'
        option ports '5 6'
config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

#eth1.1 (LAN 4)
config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0t 1'

#eth1.2 (LAN 3)
config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '0t 2'

#eth1.3 (LAN 2)
config switch_vlan
        option device 'switch0'
        option vlan '3'
        option ports '0t 3'

#not found
config switch_vlan
        option device 'switch0'
        option vlan '4'
        option ports '0t 4' 

#eth0 (WAN)
config switch_vlan
        option vlan '5'
        option device 'switch0'
        option ports '5 6' 

Btw., the "swconfig list" output:

$swconfig list
Found: switch0 - ag71xx-mdio.0

(Last edited by mwarning on 11 May 2014, 18:19)

After further testing and a dozens of resets the config o managed to do by spliting all ports.

Note 1: I not 100% sure, but if you change the WAN from VLAN 2 things are not working...
Note 2: The eth1.x should much the VLAN ID ( i didn't know that, so it might help someone smile )
Note 3: BARRIER BREAKER (Bleeding Edge, r39319)
Note 4: If you keep the reset button (WPS/Reset) for more that 15" the device resets to defaults (IP 192.168.1.1, telnet enabled )

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd30:0c4a:0bba::/48'


config interface 'lan1'
        option ifname 'eth1.1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

config interface 'lan2'
        option ifname 'eth1.3'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'
        option type 'bridge'

config interface 'lan3'
        option ifname 'eth1.4'
        option proto 'static'
        option ipaddr '192.168.3.1'
        option netmask '255.255.255.0'
        option type 'bridge'

config interface 'lan4'
        option ifname 'eth1.5'
        option proto 'static'
        option ipaddr '192.168.4.1'
        option netmask '255.255.255.0'
        option type 'bridge'


config interface 'wan'
        option ifname 'eth0'
        option proto 'static'
        option ipaddr '192.168.100.100'
        option netmask '255.255.255.0'

config interface 'wan6'
        option ifname '@wan'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0t 1'
        option vid '1'

config switch_vlan
        option device 'switch0'
        option vlan '3'
        option ports '0t 4'
        option vid '3'

config switch_vlan
        option device 'switch0'
        option vlan '4'
        option ports '0t 3'
        option vid '4'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'
        option vid '2'


config switch_vlan
        option device 'switch0'
        option vlan '5'
        option ports '0t 2'
        option vid '5'

Hello all!

My ISP gives me Internet via VLAN 14 and IP phone via VLAN 15 on WAN port (IPTV via another VLAN is coming soon). Old TL-WR1043ND v1.2 with 12.09 (Attitude Adjustment) is working properly with the following config:

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option _orig_ifname 'eth0.1'
        option _orig_bridge 'true'
        option ifname 'eth0.1'

config interface 'wan'
        option proto 'static'
        option netmask '255.255.0.0'
        option gateway '172.21.0.1'
        list dns '8.8.8.8'
        list dns '8.8.4.4'
        option ipaddr '172.21.41.45'
        option _orig_ifname 'eth0.2'
        option _orig_bridge 'false'
        option ifname 'eth0.14'

config switch
        option name 'rtl8366rb'
        option reset '1'
        option enable_vlan '1'
        option enable_vlan4k '1'

config switch_vlan
        option device 'rtl8366rb'
        option vlan '1'
        option ports '1 2 3 5t'

config switch_vlan
        option device 'rtl8366rb'
        option vlan '14'
        option ports '0t 5t'

config switch_vlan
        option device 'rtl8366rb'
        option vlan '15'
        option ports '0t 4'

Unfortunately, old TL-WR1043ND v1.2 has died :(
I got new TL-WR1043ND v2.1, now with BARRIER BREAKER (Bleeding Edge, r40361), but I can not setup it.
Default config is:

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd49:b7fd:ee11::/48'

config interface 'lan'
        option ifname 'eth1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'

config interface 'wan6'
        option ifname '@wan'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 1 2 3 4'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'

I need:
1) turn VoIP traffic (VLAN 15) - to LAN4 untagged
2) (in future) turn IPTV traffic (VLAN x) - to LAN3 untagged
3) turn Internet traffic (VLAN 14) - to NAT (router) and then to LAN1-2 untagged

I can not understand how to setup this device.
Can anyone help, please?
Thanks in advance.

(Last edited by arcd on 8 May 2014, 13:00)

Hello all!

I found configuration that meets my needs. I have asked about:
- to divert VoIP traffic coming to WAN in vlan15 - to LAN4 untagged
- (in future) to divert IPTV traffic (let's say, VLAN 17) - to LAN3 untagged
- to divert Internet traffic (VLAN 14) - to NAT (router) and then to LAN1-2 untagged

Thanks to Zanzani and his post at https://forum.openwrt.org/viewtopic.php … 28#p222528 - it helped me to understand the structure of this device.

Part 1. Default configuration:
WAN -> {p5 -> p6 in vlan2 (these VLAN's are internal in switch)} -> eth0 -> CPU-> eth1 -> {p0 -> p1-p4 in vlan1}. This is the default "router" mode.

                ________________________________
               |               CPU              |
               |eth1                        eth0|          
               |________________________________|
                 |                            |
_________________|____________________________|__
switch port   | p0 | p1 | p2 | p3 | p4 | p5 | p6 |
______________|____|____|____|____|____|____|____|
router port   |  - |lan4|lan3|lan2|lan1|wan |  - |
______________|____|____|____|____|____|____|____|
vlan1         |  u |  u |  u |  u |  u |  x |  x |          
______________|____|____|____|____|____|____|____|
vlan2         |  x |  x |  x |  x |  x |  u |  u |          
______________|____|____|____|____|____|____|____|

t = tagged
u = untagged
x = not used

Part 2. My configuration at this moment:
My ISP gives me internet in vlan14 and VoIP in vlan15.

For VoIP, I need to make a bridge between tagged WAN port p5 and LAN4 port p1 (my IP adapter is connected to LAN4).
vlan15 -> WAN -> p5 -> p1 untagged

For internet traffic:
vlan14 -> WAN -> p5 -> p6 untagged -> eth0 -> CPU -> eth1 -> p0 -> p2-p4 in vlan1

                ________________________________
               |               CPU              |
               |eth1                        eth0|          
               |________________________________|
                 |                            |
_________________|____________________________|__
switch port   | p0 | p1 | p2 | p3 | p4 | p5 | p6 |
______________|____|____|____|____|____|____|____|
router port   |  - |lan4|lan3|lan2|lan1|wan |  - |
______________|____|____|____|____|____|____|____|
vlan1 (lan)   |  u |  x |  u |  u |  u |  x |  x |          
______________|____|____|____|____|____|____|____|
vlan14 (inet) |  x |  x |  x |  x |  x |  t |  u |          
______________|____|____|____|____|____|____|____|
vlan15 (voip) |  x |  u |  x |  x |  x |  t |  x |          
______________|____|____|____|____|____|____|____|

t = tagged
u = untagged
x = not used

Configuration file /etc/config/network is:

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config globals 'globals'
    option ula_prefix 'fdfb:87a3:5dc2::/48'

config interface 'lan'
    option ifname 'eth1'
    option type 'bridge'openwrt 
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'
    option ip6assign '60'

config interface 'wan'
    option ifname 'eth0'
    option proto 'static'
    option ipaddr '172.21.41.45'
    option netmask '255.255.0.0'
    option gateway '172.21.0.1'
    option dns '8.8.8.8 8.8.4.4'

config interface 'wan6'
    option ifname '@wan'
    option proto 'dhcpv6'

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option vid '1'
    option ports '0 2 3 4'

config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '5t 6'
    option vid '14'

config switch_vlan
    option device 'switch0'
    option vlan '3'
    option vid '15'
    option ports '1 5t'

Part 3. For configuration as above, plus IPTV in vlan17 (let's say, IPTV goes to LAN3) is necessary:
a. exclude LAN3 (p2) from vlan1 to release this port for IPTV vlan17
b. add vlan17 to config and make a bridge between tagged WAN port p5 and LAN3 port p2.

                ________________________________
               |               CPU              |
               |eth1                        eth0|          
               |________________________________|
                 |                            |
_________________|____________________________|__
switch port   | p0 | p1 | p2 | p3 | p4 | p5 | p6 |
______________|____|____|____|____|____|____|____|
router port   |  - |lan4|lan3|lan2|lan1|wan |  - |
______________|____|____|____|____|____|____|____|
vlan1 (lan)   |  u |  x |  x |  u |  u |  x |  x |          
______________|____|____|____|____|____|____|____|
vlan14 (inet) |  x |  x |  x |  x |  x |  t |  u |          
______________|____|____|____|____|____|____|____|
vlan15 (voip) |  x |  u |  x |  x |  x |  t |  x |          
______________|____|____|____|____|____|____|____|
vlan17 (iptv) |  x |  x |  u |  x |  x |  t |  x |          
______________|____|____|____|____|____|____|____|

t = tagged
u = untagged
x = not used

So now vlan part of /etc/config/network will looks as following:

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option vid '1'
    option ports '0 3 4'

config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '5t 6'
    option vid '14'

config switch_vlan
    option device 'switch0'
    option vlan '3'
    option vid '15'
    option ports '1 5t'

config switch_vlan
    option device 'switch0'
    option vlan '4'
    option vid '17'
    option ports '2 5t'

Note: IPTV config in part 3 was not tested, but config in part 2 is working perfectly for me.

Hope, this information helps somebody.

p.s. Sorry for my poor English :-(

(Last edited by arcd on 29 May 2014, 18:49)

That you for your contribution.

Does some know why there are not two "config switch" sections if there are two switches?
It confuses my own code. Sadly, I do not have access to this router myself. :>

Could someone try if this works?

config switch
    option name 'switch1'
    option enable_vlan '1'

config switch_vlan
        option device 'switch1'
        option vlan '1'
        option ports '0 1 2 3 4'

config switch
    option name 'switch0'
    option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5 6'

These might give WAN as eth0 and the other switch (LAN Ports) as eth1.
Keep in mind that is just an experiment and might not work at all.

Edit: I have been told that this does not work tongue

(Last edited by mwarning on 12 Jun 2014, 00:30)

There is only one switch. There are not two config switch sections because there are not two switches.

Your config will not work because eth1 is not a switch.

Hi I have recently bricked a tl-wr1043nd v2 trying to upgrade the firmware to openwrt trunk.
Could someone guide me what is the exact steps i should do?
I got a new unit and trying to do it again.

Also My ISP provides me Internet on VLAN 500 on PPPoE.
How do i configure this?

Any help is appreciated.

I would recommend understanding how and why you bricked your last one before trying again. I would also recommend learning how to unbrick the device.

The discussion might have continued from here.