Automatic lan exchange <-> modem

I set the ifmetric. So if i run system all time choose lan, if not network change to internet from modem. Is this a good method of automatic conversion or is it better to do a script?

It should work. Script when you want to automate something.

I tested a long time and it worked. When I added vpn not anymore. However, I need to write a script.


  1. i have turn on: lan, modem, vpn
  2. i turned off lan network
  3. i switch network command sudo service openvpn restart
  4. now network is running with modem
  5. i turn on lan
  6. i have no idea how to get back to lan