Edit names of physical interfaces?

Hello,

I just installed OpenWRT onto a Ubiquiti ER-6P. The physical interfaces by default are named lan0-5. I would like to edit the names so that they match the labels on the router to avoid any confusion in the future: eth0-5. How might one go about doing this?

BTW, it's likely a switch and not individual Ethernet PHYs. While that may not confuse you - keep in mind to let us know if you make future posts for assistance. Best of luck!

2 Likes

It can only be done in the sourcecode dts file.

2 Likes

The edgerouter4 and 6 don’t have switches and the ports are directly connected to the SoC with individual PHY handles.

There is a stalled drafted PR for this change https://github.com/openwrt/openwrt/pull/13100 but the problem is that dts files are usually not changed once done and these devices are already implemented in stable releases and what happens if all the ports suddenly change name and users save the config files when upgrading?

3 Likes

It’s a good point and I’d personally avoid making the change, but when it does happen that is what the compat version flag is for, or a uci-defaults migration script.

I've stumbled upon that one too a few days ago. What exactly does it do?

Where is that set? And for how long?

Tells sysupgrade that a version is incompatible and requires special treatment. A message is included instructing the user on what to do or where to get more information.

Until it is changed again with the next incompatible change, otherwise indefinitely.
An example below.

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=70c371d91cda300d7c655f019cb2076d2dd537fb;hp=09a6bffb6e0a714f20d71043ae8382af4c5925b6

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=1bdbd511b27017157e92ffe128e66853d169dcbf

1 Like

So it's only relevant if the user wants to preserve the config during sysupgrade? (I do flash my devices without keeping settings all the time...)

No, it can be relevant to preserving or discarding settings.
Sometimes the instructions are simple “do not keep config”, sometimes they require you to flash the factory image again, and any other interesting things that may need to happen.

In the example we are talking about in this thread (renaming from lanX to ethX), a user would attempt to sysupgrade (preserve or not doesn’t matter).
The system would stop and provide the compat message saying “The Ethernet port names have changed and you cannot preserve settings when upgrading. Force upgrade to continue”.

The user would then try to upgrade again, this time selecting “force”, and hopefully not preserving (as per the warning).

3 Likes