March 24, 2019

Howto Configure Multiple Network Profiles on Linux - page 2

Freedom To Roam

  • March 17, 2005
  • By Carla Schroder

Anytime you change network settings with a profile utility, run /sbin/ifconfig to confirm the new settings.

This has been around since Red Hat 8, and it's a mighty useful little tool. However, it is not all that well documented, and has a couple of quirks that have driven more than one sysadmin to drink (admittedly a short drive for some of us) so we'll go through it step-by-step.

The Network Administration Tool starts from System Settings -> Network, or with the redhat-config-network command. On non-Red Hat systems it may be system-config-network, depending on how diligent they have been with purging Red Hat trademarks. It should open to the Devices tab and show all of your installed network adapters. The default profile is called Common- click on the Profile menu to see this. Now forget all about Common, because you'll never use it again. Anything you do to Common affects all of your profiles, which will do bad things to your emotional stability, so ignore it.

The next step is to create some new devices. Suppose that your wireless adapter is eth1, and you want to configure both an Office and a Branch_Office profile for your wireless card. Click on eth1 in the Devices tab to highlight it, then click Copy. This creates a new entry called eth1Copy. Go ahead and configure it with your Office network settings. The settings are scattered over multiple tabs and menus, so check all of them to make sure you don't forget anything. You can change the nickname as well; make it something helpful like eth1_wireless_office1. Then create another copy, and configure it for Branch Office with a different nickname, like eth1_wireless_office2.

Now create your Office profile with Profile -> New. Uncheck all the devices that you don't want for Office, and check eth1_wireless_office1. Then create your Branch_Office profile the same way. Click File -> Save when you are finished. Reboot, or restart networking, /etc/init.d/network restart.

When you reboot, the last active profile will come up. You can change to a different profile after boot with System Tools -> Network Device Control. Select the profile you want and click Activate. As easy as falling over. System Tools -> Network Device Control can be used by any user; make sure when you configure devices in System Settings -> Network (Edit -> General tab) to check "Allow all user to enable and disable this device."

You can specify a default boot profile in both Grub and Lilo. This example shows Branch_Office as the default profile in Grub:

title Fedora Core (2.6.9-1.667) Portland office
root (hd0,0)
kernel /vmlinuz-2.6.9-1.667 ro root=LABEL=/ rhgb netprofile=Branch_Office
initrd /initrd-2.6.9-1.667.img

In Lilo, it looks like this:

        label="Fedora 3- Portland office"
append= "netprofile=Branch_Office"

You can take this a step further and create multiple boot menu entries, so you can select your network profile at boot.

Most Popular LinuxPlanet Stories