No IP4 address on br-lan after making changes to openvpn config and rebooting

This has happening a few times now. I think the last change I made in each case was to add a route parameter to to my OpenVPN server config. This is fine until you reboot the router which you have to do to get openvpn to fully reload its config. The affect of this is that you lose all acces to router from the lan and wifi subnets. Luckily I have a serial port connected to the router and can get in that way. ifconfig br-lan shows that br-lan has lost its IPV4 address.

It is pain to recover form this position· It usually involves reflashing and restoring a config.

Any one got any ideas on why this is happening?

Is there an easy way from the CLI to restore the network config?

Roger

cp /rom/etc/config/network /etc/config/network might help.

It won't. For most platforms the network config is created on the fly at the first run after boot, so it is not saved in /rom.

Two ideas for @rogerjames99

  • clear all settings and package installations with "firstboot" command and reboot. Router reverts to clean situation, just like after a clean flash.
  • manually remove "rm /etc/config/system" and "rm /etc/config/network" and reboot. The system should create them again during the boot.

In general, it makes sense to backup working settings.

(I pack my settings in an archive file on my firmware image, so that I can easily expand them any time as they are on the flashed rom. As I publish my build as a community build, I use an encrypted archive file...)

Thanks guys.

I managed to get the router network settings back to normal by connected
via the serial port and using UCI to disable the open on server. I then did
/etc/unit.d/openvpn stop and ip4 addresses reappeared on br-lan. I then
rebooted the router and everything was back to normal. So it was something
in the openvpn config that was scrambling the network settings.

After a couple more reboots I narrowed it down the "route" option I had
added via luci. What I had been trying to was to duplicate the uci add_list
openvpn.myconfig.push='route 192.168.1.0 255.255.255.0' command.
Unfortunately I had not noticed was that generated uci add_list
openvpn.myconfig.route='192.168.1.0 255.255.255.0' i.e. no push.

Easy trap to fall into. Difficult one to get out of without a serial port.

Roger