I have CentOS 6.4 on which i am running virtual box.
Inside virtualBox i have CentOS based VM which works perfectly fine. The NAT and HostOnly interface have assinged IP Addresses through DHCP and they work just fine.

However i create some internal network interfaces and add custom IP Addresses. It works fine but later after sometime suddenly those IP Addresses are removed automatically. I have no idea why this happens, and because of this my communication stops. I simply statically assign the IP address again and it starts working again which later after sometime, (appox 25 seconds) the configurations are disappeared and interface is left without any ip address.

1 Answer
1

Just that someone else gets across this problem, here i found the solution:

Background:

I used VirtualBox to setup linux machine, update it and install everything, then make a linked clone from this machine every time i have to do something. Problem comes with this setup is when you have configured some interfaces and you create a linked clone (even after reinitialize=ing mac addresses, network interface settings will interfere with base machine). The solution for this is before creating a linked clone, remove all interfaces from VirtualBox settings and create linked clone.

Now when you setup a new machine and re-create network interfaces through virtualBox, there is no problem however the IP address was now resetting because although interfaces exist, but there is no interface configuration file in

/etc/sysconfig/network-scripts/ifcfg-eth0

Solution:

Simple create a ifcfg-eth0 file and most importantly set the field:

BOOTPROTO="none"

and optionally set it with your desired configurations or whatever you want with it, then do a:service network restart.

After this, whatever you configure temporarily using ifconfig, will stay and no resetting will occur.

PS: since CentOS 6.4, BOOTPROTO=static option no longer exists, and if you do not set BOOTPROTO=none, what ever IP address you assign on linked clone machine, it will reset after few seconds.