I currently switch between the following two set-ups on a daily basis:
1) Being connected to the internet via a WiFi network.
2) Having my (Ubuntu 16.04) laptop connected to the internet via a wired connection, then sharing this connection with my other devices through the built-in hot-spot functionality of Ubuntu.
At the moment, switching from 1 to 2 requires me to manually go through the "connect to hidden network" dialogue in the Network Manager; similarly switching from 2 to 1 requires me to manually disconnect from the hotspot and connect to the WiFi network. It's not a lot of work, but I do it often enough that I would like to have it be automated.
It is not as simple as enabling autoconnect for the hotspot, since then it overrides the autoconnect functionality of other networks instead of connecting me to a WiFi network when I am not connected via a wired connection, and I end up with a hot-spot but no internet. So I need a solution which:
- connects me to the hot-spot whenever I am connected to the internet via a wired connection.
- disconnects me from the hot-spot when there is no ethernet connection.
- autoconnects me to one of the networks with autoconnect=true whenever they are available and there is no ethernet connection.
A full explanation on how to do this would be great, but a reference to a good (non-expert) manual for setting up these kinds of rules would also be very much appreciated.
post-up
of the/etc/network/interfaces
context, there is a great overview here.post-up
basically just calls commands, or scripts, after an interface comes up.