Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to setup two network profiles in Centos. One for at home, one for at work. The home profile has a fixed IP address, fixed gateway and DNS server addresses. The work profile depends on DHCP.

I've created a 'home' and a 'work' directory in /etc/sysconfig/networking/profiles. Each has the following files containing the proper configuration:

> -rw-r--r-- 2 root root  422 Apr 17 20:17 hosts
> -rw-r--r-- 5 root root  223 Apr 17 20:18 ifcfg-eth0
> -rw-r--r-- 1 root root  101 Apr 17 20:17 network
> -rw-r--r-- 2 root root   73 Apr 17 20:18 resolv.conf

There was already a 'default' profile, which contains the same files.

Then I issued these commands:

system-config-network-cmd --profile work --activate
service network restart

I was expecting these files to get copied from the profiles/work directory to /etc/sysconfig/ and /etc/sysconfig/networking-scripts. And most files do get copied, except for ifcfg-eth0.

Stangely enough that files seems to be overwritten with the current settings when I issue system-config-network-cmd. The other files are also touched, but there contents stays in tact.

The system is Centos 5.7 running on a virtual pc within a windows 7 machine. Here is the output for ifconfig:

# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:03:FF:6F:2E:AB
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::203:ffff:fe6f:2eab/64 Scope:Link
          RX packets:4199761 errors:7 dropped:0 overruns:0 frame:0
          TX packets:1733750 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2316624688 (2.1 GiB)  TX bytes:415533386 (396.2 MiB)

Can someone tell what I'm missing here?

share|improve this question
What version of CentOS is this? Are both home/work connections wired/wireless/one of each? – uther Apr 19 '12 at 13:40
Centos 5.7 final. Both are wireless connections in reality but the system is running on a virtual machine hosted on windows 7 so the adapter may in fact be mapped to a wired virtual adapter, I'm not sure. I've added ifconfig output to the original post, maybe that helps? – Leven Apr 20 '12 at 9:18
What VM are you using (vmware, virtual pc etc) and what have you got the virtual adapter set to (bridged, NAT, Host only etc)? – Tim Alexander May 24 '12 at 16:03
up vote 1 down vote accepted

As it follows from the RedHat's documentation on networking profiles, you should not use base interface name (eth0) for profile interfaces, but have one called as eth0_work and so on. BTW, you don't need to restart network configuration, since profile switching handles it by its own. An example:

# system-config-network-cmd --profile foobar --activate
Network device deactivating...
Deactivating network device eth0, please wait...
Network device activating...
Activating network device eth0_foobar, please wait...
share|improve this answer

Why use profile here ?

Suppose eth0 was the home line , static IP , edit:



And for the other work line , use DHCP , edit:



And ensure the network service starts on boot.

e.g if you run the service at level 2 , 3 , you can do:

chkconfig --level 23 network on

Reboot to see changes.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.