Can i change the port label on LuCI Port status?

Hello there,

first of all: If this isn't the right place for this question, please feel free to point me to the correct place.

I'm running a AVM FB7530 with OpenWrt 23.5.05.
It uses lan4 as WAN, connected to an external modem.
This all works flawlessly.

The only thing i'd like to change is the label of lan4 in the port status.
Is it possible (how?) to change this to 'wan'?

Thanks in advance.

Those are pre-set as printed on the case of device

Those come from the hardware definition in DTS.

This data is read from the file:
/etc/board.json

At the moment I am using a modem/router on an FTTP connection, so I have an unused 'DSL' port displayed.
I have not yet found a way to modify the configuration that survives a release update.
In the meantime, I manually edit the file after each upgrade.
Note, I think that the names used in this file must correspond to ports/bridges listed in the 'devices' tab of 'network/interfaces' page in LuCI.

I've got an experimental setup on one of my x86 devices. I hacked /etc/board.d/99-default_network to read the network config like this:

#
# Copyright (C) 2013-2015 OpenWrt.org
#

. /lib/functions/uci-defaults.sh

board_config_update

json_is_a network object && exit 0

if uci -q get network.ports > /dev/null; then  # EF -start hackery
        wan=$(uci -q get network.ports.wan)
        lan=$(uci -q get network.ports.lan)
        [ -n "$lan" ] && ucidef_set_interface_lan "$lan"
        [ -n "$wan" ] && ucidef_set_interface_wan "$wan"
else  # EF -end hackery
        ucidef_set_interface_lan 'eth0'
        [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
fi

board_config_flush

exit 0

Then added this to /etc/config/network:

config ports 'ports'  # EF experiment, see /etc/board.d/99-default_network
        option wan        'eth0'
        list   lan        'eth1'
        list   lan        'eth2'
        list   lan        'eth3'

This creates the proper entries in board.json on upgrades, make sure to do echo "/etc/board.d/99-default_network" >> /etc/sysupgrade.conf so it doesn't get overwritten if you do something like this.

1 Like

Thank you.
I have a BPI-R4 acting as a "dumb AP" (with wireless disabled) running 24.10-SNAPSHOT.

On this, I have updated the three files:
/etc/board.d/99-default_network as you wrote;
/etc/config/network edited to my needs;
/etc/sysupgrade.conf as you wrote.

Is there a way to trigger this config. update to check it works?
Or do I have to wait until I attempt my next update, which will be to flash the next bananapi_bpi-r4-squashfs-sysupgrade.itb image, retaining the configuration?

Hmm, good question... I think maybe rm /etc/board.json and reboot would do it without an upgrade.

EDIT: Yup, just tried it and that's a good test, at least on my x86 box.

1 Like

I obviously have something wrong as that does not work, nor does upgrading to the latest 24.10-SNAPSHOT, retaining the current config.
(I download the image and manually " Flash new firmware image", retaining current config. through LuCI. I then add the extra packages I want.)

Below are the contents of the files after upgrade:
/etc/board.d/99-default_network:

#
# Copyright (C) 2013-2015 OpenWrt.org
#

. /lib/functions/uci-defaults.sh

board_config_update

json_is_a network object && exit 0

f uci -q get network.ports > /dev/null; then  # @efahl -start hackery
        wan=$(uci -q get network.ports.wan)
        lan=$(uci -q get network.ports.lan)
        [ -n "$lan" ] && ucidef_set_interface_lan "$lan"
        [ -n "$wan" ] && ucidef_set_interface_wan "$wan"
else  # @efahl -end hackery
        ucidef_set_interface_lan 'eth0'
        [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
fi

board_config_flush

exit 0

/etc/sysupgrade.conf:

## This file contains files and directories that should
## be preserved during an upgrade.

# /etc/example.conf
# /etc/openvpn/
/etc/board.d/99-default_network

/etc/config/network (Last Section):


config ports 'ports'  # @efahl experiment, see /etc/board.d/99-default_network
        option wan        'wan'
        list   lan        'br-guest'
        list   lan        'br-lan'
        list   lan        'lan1'  
        list   lan        'lan2'      
        list   lan        'lan3'

Hmm, what do those two uci commands show? Here's what I see:

$ uci -q get network.ports.wan
eth0

$ uci -q get network.ports.lan
eth1 eth2 eth3

After

root@BPIR4:~# rm /etc/board.json
root@BPIR4:~# reboot
root@BPIR4:~# uci -q get network.ports.lan
br-guest br-lan lan1 lan2 lan3
root@BPIR4:~# uci -q get network.ports.wan
wan

These are the values I want to see in /etc/board.json
I even tried unplugging the power after deleting the file, with the same outcome.
I will also try this on a BTHH5 running 23.05.5.

Aha, figured it out, the BPI-R4 (mediatek/filogic) does not use the generic 99-default_network file. The code that does network setup is in /etc/board.d/02_network (the x86 variant of that file bails on "generic" devices and uses the 99- file).

So...
Edit the 02_network file, scan down to about line 61 and you'll see where it's doing the network setup. Just hack that up directly and change sysupgrade.conf to point to the new file, then get rid off all the 99-* junk we put in place (or alternatively have the 02 file run . /etc/board.d/99-default_network instead of just doing the current uci_set_interfaces....

That has indeed done the trick.
Many thanks
(I have got into the habit of creating ".bak" copies of files I am about to mess with, so reverting the 99- file was trivial.)
Regards

1 Like

Hi everyone,

sorry for the newbie question, but just so I understand this correctly: if I manually edit /etc/board.json and /etc/config/network, I could e.g. replace lan1 with office and that would then show up in LuCI correctly, e.g. on the Port Status page?

Thanks & best, Florian

Unfortunately, no.
As far as i understand the logic behind this, this will only work with device names like lan1...4, wan, dsl.

It would be nice to have a way to label the ports in the status overview with any name one wants, but that's not possible (yet?).

1 Like

I think this can be done:
Backup your system configuration first.
(Create local backup copies of /etc/board.json and /etc/config/network.)
Edit /etc/config/network to create a new bridge device called 'office' to use the port 'lan1';
delete 'lan1' from the existing bridge device 'br-lan'.
Edit /etc/board.json to replace 'lan1' with 'office'.
Check your Port Status page.
(I think the ports are displayed in alphabetic order.)

1 Like

Hrm, I was fiddling around with board.json and config/network, to little avail, but after I've restored the backups, the whole Port Status component in LuCI has vanished :face_with_peeking_eye: Any ideas how I could get it back? Remove luci-mod-status and reinstall?

Not so good.
Have you tried deleting the /etc/board.json file and rebooting as suggested in post 7?

Other than that, I am not sure what to suggest.

1 Like

Thanks for the suggestion, I'll have to try that when the router is not heavily used :sweat_smile: I'll post an update whether that worked ASAP.