Howto Configure Multiple Network Profiles on Linux - page 4
Freedom To Roam
Netenv tries to be cross-platform; there are RPMs that work on Red Hat, SUSE, and Fedora, as well as CentOS and the rest of the clone crowd, and a Debian package. With Netenv you create a set of network configurations, then select the one you want from a menu. Create a new network profile with the netenv command, as root:
A curses-based window will open, and should have two entries: Installation_Default, and New Set_up_new_environment. Select New and it will walk you through a new setup. Note that it only accepts one DNS server; if you're used to entering two, it won't work. When you're finished it asks "Do you want to activate changes by restarting the network?" On Debian didn't work, so I had to run /etc/init.d/networking restart manually.
To change to a different profile, simply run netenv again, select from the menu, and restart networking. Netenv will prefix your profile name with your hostname. For example, if your hostname is workstation1 and your profile is branch_office, the configuration file will be /etc/netenv/workstation1-branch_office. On the netenv menu this appears as branch_office unknown. You can replace "unknown" with anything you like, using the netenv_id option:
/etc/netenv/netenv.conf has a few interesting options. NETENV_RUN_INIT_SCRIPTS= is the place to list any services that need to be restarted when you change to a different profile. This is for /etc/init.d/ scripts that have a "restart" option. For scripts that only use start/stop, use the NETENV_START_STOP_SCRIPTS= line.
You might want to use NETENV_REMEMBER_LAST=yes and NETENV_REMEMBER_LAST=default. This will automatically boot the last profile you used, and make it the default when your NETENV_TIMEOUT= runs down.
- 1Linux Top 3: Alpine Linux 3.4, deepin 15.2 and Linux Lite 3.0
- 2Linux 4.7 Set to Boost Live Patching, Security and Power Management
- 3Linux 4.6 Charred Weasel adds USB 3.1 Support
- 4Linux Top 3: OpenIndiana 2016.04, Ubuntu 16.04 and Debian's New Leader
- 5Linux Top 3: KaOS 2016.04, TurnKey 14.1 and pfSense 2.3