March 18, 2018

Howto Configure Multiple Network Profiles on Linux - page 4

Freedom To Roam

  • March 17, 2005
  • By Carla Schroder

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:

# netenv

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.

Most Popular LinuxPlanet Stories

Sitemap | Contact Us