1

When booting up the VM (Scientific Linux 6.4) in VirtualBox (4.3), I'm getting the same ip address for both network interfaces.

VirtualBox has NAT for the first network adapter, and Host-Only for the second network adapter.

VM is configued as follows:

ifcfg-eth0

DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=no
Type="Ethernet"

ifcfg-eth1

DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.56.107
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
Type="Ethernet"

Results of ifconfig

eth0      Link encap:Ethernet  HWaddr 08:00:27:E8:14:8B  
          inet addr:192.168.56.107  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fee8:148b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth1      Link encap:Ethernet  HWaddr 08:00:27:92:0A:6D  
          inet addr:192.168.56.107  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe92:a6d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

If I execute the following:

# ifdown eth0
# ifup eth0

Then eth0 gets the correct ip address.

eth0      Link encap:Ethernet  HWaddr 08:00:27:E8:14:8B  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fee8:148b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

Why is it not picking up the correct ip address on boot? How do I configure it to have the correct ip for eth0?

1

If you are not changing your network adapter every time you boot the VM add HWADDR=08:00:27:E8:14:8B to the ifcfg-eth0 configuration and remove NM_CONTROLLED=no as in case of DHCP assignment it won't make a difference and reboot to see if helps.

  • Added HWADDR and dropped NM_CONTROLLED on both, and made sure BOOTPROTO=static for eth1, and it worked correctly on boot. – Marcus Jan 30 '14 at 19:35
0

Eth0 is getting its address from DHCP which can change IP addresses. One side or the other is correctly assigning a different IP address to the second interface.

Both IP addresses may be reachable from each interface. If you want only one IP address, create a bridge containing both interfaces and assign the address to the bridge.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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