[BPI-R4] Are there any way to rename wan device to lan0?

Are there any way to rename wan device to lan0 and define it as LAN port? I do want to use all “joined” ethernet ports as LAN. Ive connected wan over sfp port

Why rename it and not just put it in lanbr0?

Renaming should be possible with systemd and udev,but because of missing fixed mac you have to match by original name

it would look a bit misleading and may lead to errors while doing configuration. Imagine that you are configuring router and see “wan” which in reality its not)) In Mikrotik it can be done with few clicks … in openwrt its a bit tricky

I had the same problem (on debian bullseye). I want to rename wan → fth4 and assign a specific MAC addr to that interface. To do that you just need to put a file ending in ‘.link’ into ‘/etc/systemd/network’ directory. That’s all e.g.:

/etc/systemd/network/25-fth4.link:

[Match]
OriginalName=wan

[Link]
Name=fth4
#MACAddressPolicy=none
MACAddress=00:13:3b:11:22:33

this way I reassigned other names and MAC addresses to all interfaces.

1 Like

the problem is that I want to do that in openwrt … not planning to work with linux distros

Maybe this helps

https://www.reddit.com/r/openwrt/comments/keyr82/rename_interface/

But i do not use openwrt,so cannot help more than googling for you

Dont have BPI next to me for the moment but Ive as I remember Ive seen some system initialization script that do some magic port initialization depending from BPI model … have no idea what it exactly do

Port names come from devicetree…if you compile yourself you can change name there too

I do prefer standard shipped distros to do not compile each time just to update system. The ideal way to deal with problems is to use config files to use extra script to deal with the issue. PS You may remember my topic for R3-Mini and issue with initialization SSD delay. There Ive created a script that init ssd a few moment later instead of compiling own wrt with patch that deal with ssd init delay

Since this is a general openwrt issue, you may have more luck finding your answer in the openwrt forum.

I also don’t like that the lan0 port is named wan by default, I found how to change it: in the openwrt source files you need to find the mt7988a-bananapi-bpi-r4.dtsi file and delete the

&gsw_port0 {
    label = "wan";
};

block in it after compiling the firmware in the usual way

1 Like

Ah! This is cool!

So you’re changing /openwrt/target/linux/mediatek/files-6.6/arch/arm64/boot/dts/mediatek/mt7988a-bananapi-bpi-r4.dtsi before building?

Is there a way to turn that dtsi change into a local patch?

changing before building?

Yes

Is there a way to turn that dtsi change into a local patch?

I don’t know. I’m not a pro at building OpenWRT, I found this in the source, tried to change it and it worked.