I wasn't sure what to call this in the subject line, but here's my issue. I have an occasional need to switch a few computers from one Internet provider to a different one. Both Internet providers feed into the same network, one at 192.168.0.1 and the other at 192.168.0.254. So to change from one provider to the other I run nmtui to change the gateway and dns server addresses, then deactivate and reactivate the connection and I'm done. It's just takes a few minutes, but I'm wondering if there's a way to automate this a bit so instead of having to run nmtui and change all of those numbers, then deactivate and reactivate the connection, I could just have each configuration saved as a text file or something, and just tell network manager "use this configuration now until further notice." I could, of course, accomplish this using dhcp and change the dhcp server configurations as needed, but I'd prefer to have all of this stuff stored on each local machine like it is now. That way I could even automate it with a cronjob or something if I wanted to get that efficient. -- Can we uninstall 2020 and install it again? This one has a virus. MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com
On Mon, 26 Oct 2020 15:25:37 -0600 Frank Cox <theatre at sasktel.net> wrote:> I have an occasional need to switch a few computers from one Internet > provider to a different one. Both Internet providers feed into the > same network, one at 192.168.0.1 and the other at 192.168.0.254. > > So to change from one provider to the other I run nmtui to change the > gateway and dns server addresses, then deactivate and reactivate the > connection and I'm done. > > It's just takes a few minutes, but I'm wondering if there's a way to > automate this a bit so instead of having to run nmtui and change all > of those numbers, then deactivate and reactivate the connection, I > could just have each configuration saved as a text file or something, > and just tell network manager "use this configuration now until > further notice."I would create two different NetworkManager connection profiles, called eth0-isp1 and eth0-isp2. You can use the GUI, TUI, or CLI for this. The something like `nmcli connection down eth0-isp1 && nmcli connection up eth0-isp2` should work. Jim
Once upon a time, Frank Cox <theatre at sasktel.net> said:> I have an occasional need to switch a few computers from one Internet provider to a different one. Both Internet providers feed into the same network, one at 192.168.0.1 and the other at 192.168.0.254. > > So to change from one provider to the other I run nmtui to change the gateway and dns server addresses, then deactivate and reactivate the connection and I'm done.You could just create multiple connection profiles, like "provA" and "provB". Then to switch A->B would be "nmcli con down provA; nmcli con up provB". You'd only want one to autoconnect though, so maybe: nmcli con down provA nmcli con mod provA autoconnect 0 nmcli con up provB nmcli con mod provB autoconnect 1 Or you could even get fancier with a script that would check the currently active and switch to the other one. -- Chris Adams <linux at cmadams.net>
Reasonably Related Threads
- Reliable way of having both LAN and WIFI on headless box
- Reliable way of having both LAN and WIFI on headless box
- Reliable way of having both LAN and WIFI on headless box
- nmcli: unwanted secondary ip-address
- Qemu - enabling "bridge mode" for primary physical interface for VMs