Switch / WAN / LAN configuration for TP-Link Deco S4

Hello,

I was able to get a 19.07-SNAPSHOT build running on my TP-Link Deco S4 by modifying this fork.

The devices have two Ethernet ports; I would like to configure one to be WAN with DHCP, and the other to join the radios as LAN so I can add another one of these devices for ethernet backhauling.

Out of the gate, the board config is this:

	tplink,deco-m4r-v1v2)
		ucidef_add_switch "switch0" \
			"0@eth0" "3:lan:1" "5:lan:2"
		;;

Which results in this network config by default":
image

I added a new interface, called WAN, and assigned it to eth0.1, dhcp protocol, and changed the bridge lan to eth0 (switch), and the radios with static addresses. This works great for the WiFi but completely breaks down if I plug another device into the second ethernet port on the deco. It seems that this makes the computer I plug into ethernet assume the role of WAN and obviously disconnects the entire network from the internet.

The current network config is this:

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 'fdde:92e3:e9da::/48'

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

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

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

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

I tried adding a new switch_vlan so that I would tease out the different ports, but I seemed to break it even more. Basically I'm struggling to understand the basics and would appreciate some guidance on what these settings mean, and how to get to the ends I'm after. Thanks!

Edit:

I’ve marked the contributors answer as the solution, because it would be for most use cases. With some tweaking for my fork and custom firmware I have my device behaving appropriately.

What you have done here is assigned logical ports 3 and 5 to eth0.1 This effectively means that your wan is found on two physical ports., and so your problem description seems to follow from this.

You are also using outdated methods for defining bridges (although it is possible your customized version will differ)

A better configuration would be as follows:

config interface 'br-lan'
        option type 'bridge'
        option device 'eth0.2'

config interface 'lan'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option device 'br-lan'

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

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

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

config interface 'wan'
        option device 'eth0.1'
        option proto 'dhcp'

Note that I have assigned logical port 3 to VLAN 2 (which is now the LAN), and logical port 5 to the WAN... so physical ports may or may not be right here -- if they're swapped, simply change VLAN 2 to logical port 5 and vice versa.

Thanks, I’ve recreated your configuration on my box, but the issue persists. When I plug in a device to the other available port arp -a reveals that the gateway is my isp and not my router.

Hitting the internet is fine, but over Ethernet I can’t hit 192.168.1.1. Over wifi all devices have lost the internet (the Ethernet device has it) but can all hit 192.168.1.1.

Here's the updated config:

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 'fdde:92e3:e9da::/48'

config interface 'br-lan'
	option type 'bridge'
	option device 'eth0.2'

config interface 'lan'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option device 'br-lan'

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

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

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

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

Interestingly, LuCI also has all interfaces marked for deletion:


Edit to add that these aren't actually ever deleted, and this state persists across a powercycle. I have not pressed "save & apply"

When I use service network reload I encounter: Failed to load config file: : Parse error (invalid character in name field) at line 11, byte 26
This is the br-lan line.

Maybe it would be best to reset to defaults, then post the default configuration... we can work from there.

But, you might need to seek help from the maintainer of the fork that you modified. It is possible that the version you're using requires different configuration methods than standard OpenWrt. And, it is not a given that the modifications that you made will work as expected -- you might have made an error and/or the changes may not be valid in the context of that fork.

1 Like

Thanks, the invalid character was the dash in br-lan. Removing that allowed this config to be loaded. Inside of luci br-brlan is marked as having an invalid protocol type. There is no proto field set in the config for brlan

Lastly, it looks like my release does not like device in place of ifname under interfaces.

Edit:

It is working now 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 globals 'globals'
	option ula_prefix 'fdde:92e3:e9da::/48'

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

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

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

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

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

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.