Which script generate default /etc/config/network?


I want to modify /etc/config/network that wan port has fixed ip address, so if router is reseted
there are my defaults.
I've not found a config file, so I guess this is created online.
Which file does create this file?

I think the network configuration is created by the scripts in /etc/board.d, such as /etc/board.d/99-default_network if the network hasn't already been configured by another script.

# cat /etc/board.d/99-default_network 
# Copyright (C) 2013-2015 OpenWrt.org

. /lib/functions/uci-defaults.sh


json_is_a network object && exit 0

ucidef_set_interface_lan 'eth0'
[ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'


exit 0

Include your config in files/etc/config/network when you build from source, or similarly for the image builder.

1 Like

I like the /etc/uci-defaults approach the most.