[Solved] Swapping eth0 and eth4 on Edgerouter X

I'm using an Edgerouter X and I'd like to swap the ports around so that the WAN is on eth4 and eth0 is a regular LAN port. This is a supported configuration in the factory firmware and allows the device to be powered over PoE from a PoE switch.

I've changed my /etc/config/network like so, by changing wan and wan6 to eth4 and adding eth0 to br-lan:

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

config globals 'globals'
	option ula_prefix 'fd62:2333:0b28::/48'
	option packet_steering '1'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0'
	list ports 'eth1'
	list ports 'eth2'
	list ports 'eth3'

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

config interface 'wan'
	option device 'eth4'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth4'
	option proto 'dhcpv6'
	option reqaddress 'try'
	option reqprefix 'auto'

And it seems to be working, however, LuCI still shows eth0 as an "Ethernet Adapter" and eth4 as a "Switch Port":

Is that a problem, and even if not, is there a way to fix it?

in my opinion there is no problem it should show you the same on the other ports eth0,1,2,3,4 (DSA emulation I guess)

To be clear, port eth0 can only be powered by a 24V passive PoE source. Most typical PoE switches are 802.3af/at/bt -- providing 48V active PoE. This will not power an ER-X. (it won't damage it, but it just won't achieve your goal).

You can buy an 802.3af > 24V passive adapter from Ubiquiti which will make this possible. (or obviously use a 24V passive PoE injector or a PoE switch that actually provides this type of PoE).

Your configuration looks fine, though.

2 Likes

That's just Luci.

And yes to everything @psherman said about the power. If you want to power the unit from an IEEE af/at switch, the simplest cheapest way is a "PoE Splitter" with 12 volts out and plug its power outlet cable into the DC socket on the back of the ER-X.

Also beware of turning on the power on port 4-- it is only for Ubiquiti "passive 24 volt" devices. Hardware damage will result if you try to power a non-PoE device or an IEEE standard one that is not also 24 volt capable.

1 Like

Yup. This will work, too. But at that point, the port on the er-x becomes non-critical since this could also be achieved with eth4.

Yeah, I have an 802.3af-to-24v-passive converter box (not from Ubiquiti but the pinout matches) and will be using that.

I dove a little more into the DTS files and it looks like LuCI is reflecting the actual hardware configuration, where eth0 is on gmac1 while eth1/2/3/4 are on gmac0. If I'm understanding it right, DSA deals with that, but I would have performance limitations for any Ethernet devices attached to eth1/2/3, because they'd be sharing the same CPU port as the WAN?

There is actually only a single cpu connection to the hardware switch. All 5 ports are connected to the switch chip. So there is no performance difference.

Alright, I won't worry about what LuCI says, then. :slightly_smiling_face: Thanks!

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Thanks! :slight_smile:

I actually think that @j4cbo is right: Since the "2 Gbps WAN/LAN patch" on mt7621 hardware, wan is directly connected to the CPU (see here). There is currently no runtime configuration to change this (but it is planned, see this issue).

1 Like

I recall seeing a post on the ubiquiti forums where someone had reverse engineered the er-x and showed just a single cpu connection (and this why the er-x can route at a maximum aggregate of 1Gbps bandwidth, making it unable to fully utilize a symmetrical 1Gbps connection). But maybe that info was wrong or out dated.

That is true for the ER-X SFP, not for the ER-X - I just stumbled upon that in the already linked 2Gbps WAN/LAN thread (2 Gbps WAN/LAN NAT Routing on ramips MT7621 devices - #215 by kam821).

But @Borromini is right, the port labelling on this router is very confusing!

1 Like

Indeed. But afaik, DSA aims to make the port naming in the config consistent with those printed on the device itself, thus the ethX naming (which is far less common now with DSA)

Thanks for the links @andyboeh! That helps a lot. As I understand it:

  • In the current configuration, any traffic on eth1, eth2, or eth3 will share the same CPU port as the WAN interface, so traffic between any of those ports and eth0 will have to traverse the CPU, and traffic between those ports to the WAN will go in and out the same CPU port. Packets will still be handled correctly, this is just a potential performance limitation.
  • If I really wanted to, I could modify mt7621_ubnt_edgerouter-x.dts to use gmac1 for eth4, as in Example 2 here. Only eth0 and eth4 can be configured this way. What the device tree calls gmac1 is called GMAC5 on the SoC, which is just slightly confusing :upside_down_face:

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