OpenWrt Forum Archive

Topic: Reset network configuration

The content of this topic has been archived on 4 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I would like to know how to revert to default network configuration, ie revert /etc/config/network to defaults and let other files intact

Where is /etc/config/network generated?

If I delete the file and reboot the router it gets generated again but i need to do it programically in a uci-defualts script

/rom/etc/uci-defaults

Villeneuve wrote:

/rom/etc/uci-defaults

Tried to execute relevant scripts, they didnt do the trick

root@OpenWRT:~# grep  -r network /rom/etc/uci-defaults/
/rom/etc/uci-defaults/03_network-switchX-migration:        uci_set network "$config" $option $newname
/rom/etc/uci-defaults/03_network-switchX-migration:        config_load network
/rom/etc/uci-defaults/03_network-switchX-migration:        logger -t migrate-switchX "Updating switch names in network configuration"
/rom/etc/uci-defaults/03_network-switchX-migration:            logger -t migrate-switchX "Switch names updated, saving network configuration"
/rom/etc/uci-defaults/03_network-switchX-migration:            uci commit network
/rom/etc/uci-defaults/03_network-vlan-migration:local dev="$(uci -q get network.@switch_vlan[0].device)"
/rom/etc/uci-defaults/03_network-vlan-migration:local vlan="$(uci -q get network.@switch_vlan[0].vlan)"
/rom/etc/uci-defaults/03_network-vlan-migration:           uci set network.@switch_vlan[0].vlan=1
/rom/etc/uci-defaults/03_network-vlan-migration:           uci commit network
/rom/etc/uci-defaults/12_network-generate-ula:[ "$(uci -q get network.globals.ula_prefix)" != "auto" ] && exit 0
/rom/etc/uci-defaults/12_network-generate-ula:     set network.globals.ula_prefix=fd$r1:$r2:$r3::/48
/rom/etc/uci-defaults/12_network-generate-ula:     commit network

root@OpenWRT:~# sh /rom/etc/uci-defaults/03_network-switchX-migration
root@OpenWRT:~# uci show network
root@OpenWRT:~# sh /rom/etc/uci-defaults/03_network-vlan-migration
root@OpenWRT:~# uci show network
root@OpenWRT:~#

Found

/bin/config_generate

The discussion might have continued from here.