Static ip address on two interfaces.

Issues related to configuring your network
Post Reply
lukas1989
Posts: 2
Joined: 2011/11/12 13:55:44

Static ip address on two interfaces.

Post by lukas1989 » 2011/11/12 14:14:34

Hi all,
I've just install CentOS 6 on VirtualBox. I have three interfaces: lo, eth0, eth1. I'ld like to have a static ipv4 address for eth1 interface. In directory /etc/sysconfig/network-scripts I create a new file calls ifcfg-eth1. (Before that operation only ifcfg-lo exist). File ifcfg-eth1 looks like:
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
NETWORK=192.168.3.0
NETMASK=255.255.255.0
IPADDR=192.168.3.3
USERCTL=no

When I reboot CentOS, eth0 and eth1 have the same ipv4 address -> 192.168.3.3 . Eth1 is connected to nat and when i called dhclient eth0 then to the interface eth0 was added address from server dhcp (on virtualbox). Why in that configuration which is above address 192.168.3.3 is added to eth0 interface. When file ifcfg-eth1 doesn't exist then none interface have that address.

P.S.
Sorry for my poor English.

User avatar
jlehtone
Posts: 2870
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Static ip address on two interfaces.

Post by jlehtone » 2011/11/14 13:22:20

What if you do create both ifcfg-eth0 and ifcfg-eth1?

lukas1989
Posts: 2
Joined: 2011/11/12 13:55:44

Re: Static ip address on two interfaces.

Post by lukas1989 » 2011/11/14 21:12:17

[quote]
jlehtone wrote:
What if you do create both ifcfg-eth0 and ifcfg-eth1?[/quote]

I've created both but ifcfg-eth0 has another ipv4 address and when i reboot CentOS then end effect is the same as above. Both have 192.168.3.3

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Static ip address on two interfaces.

Post by pschaff » 2011/11/15 22:03:38

Welcome to the CentOS fora. Please see the recommended reading for new users linked in my signature.

I suspect this is another effect of the change [url=http://wiki.centos.org/FAQ/General?highlight=%28TUV%29#head-d29a2b7e61ffc544973098f9dd49fe4663efba50]TUV[/url] made to use NetworkManager by default rather than the network service. It seems to cause a lot of confusion and conflicts. I believe you should either disable NetworkManager and insert a line[code]NM_CONTROLLED="no"[/code]in each configuration, or use nm-applet to configure both interfaces.

Post Reply

Return to “CentOS 6 - Networking Support”