Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

The 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:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::203:ffff:fe6f:2eab/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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)
          Interrupt:9

Can someone tell what I'm missing here?

share|improve this question

1 Answer 1

To access a virtual machine configured within IP range assigned from router - 192.168.0.1 from home network - 192.168.1.0, we can use the following procedure:

Inside your virtual machine, type ‘neat’ command which is used to configure network adapters. As of now, we have configured two adapters – loopback and one with IP 192.168.0.30 for example. If we have to use this virtual machine on another network, then we need to add another adapter using ‘New’ option that we get with neat. We need to add a new network adapter and assign IP in the range of host network. For example, the IP for this network adapter should be 192.168.1.5 (the permissible range in your network), 255.255.255.0 (subnet mask), 192.168.1.1 (default gateway). Save these settings. In /etc/resolv.conf file you need to add an entry – nameserver 192.168.1.1. In /etc/hosts file, add another entry for this new IP ie. 192.168.1.5 example () and restart network service.

Ping windows machine from linux and linux machine from windows, you should be able to ping it. NO CHANGE is needed in windows host file, if you wish to access your virtual machine with IP address. But if you want to use hostname, then you need to add another entry in c:/windows/system32/drivers/etc/hosts files – 192.168.2.5 example, considering your machine hostname is example, as hosts file is used for name resolution.

So you can work in bridged environment without changing any IP at home and office.

share|improve this answer

Your Answer

 
discard

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.