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.
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?
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:
## 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'
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
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?
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.)
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 Any ideas how I could get it back? Remove luci-mod-status and reinstall?