0

I've created a new Oracle Virtual Box image and exported it to an "Open Virtualization Format Archive" (ova file). The original image used "NAT" settings. I've since changed it to "Bridged Adapter" so that I can Putty into it on port 22 (SSL). I then launched it, and exported it. The problem I'm having right now is I get the same IP address for each instance I import from the *.ova I exported.

I'd like to launch multiple instances of this image and have each machine get a new IP address whenever I import the image and launch it. I'd ultimately like an export of the image, so I can test this again if I'm able to fix the duplicate IP address issue.

MacGyver
  • 1,864
  • 7
  • 37
  • 50
  • 2
    This is something you need to configure on the guest OS, i.e. to use DHCP. – Ward - Reinstate Monica Mar 02 '16 at 19:41
  • See my answer. I had DHCP turned on the whole time. /etc/sysconfig/network-scripts/ifcfg-eth0 ... had the following line: BOOTPROTO="dhcp" – MacGyver Mar 02 '16 at 22:39
  • I had the same exact question a long time ago (with VMWare not VirtualBox), but before, my answer explains exactly what happened. Extracting from the original, which had not been booted at all, wouldn't have gotten that line set. Which makes perfect sense why re-extracting worked. http://serverfault.com/questions/595337/i2b2-vm-copy-vm-wont-give-me-a-valid-ip-address – MacGyver Mar 02 '16 at 22:43

1 Answers1

0

After a few hours of research, I found the answer. Whenever a guest OS is cloned (in VMWare or VirtualBox), the interface rules can get messed up in CentOS. I simply deleted that file and rebooted the machine. And I instantly got a new IP address. The file below also got re-created with a single entry for the "eth0" interface. The line containing the "eth1" was no longer there. Rebooting the CentOS OS must rebuild that file.

rm /etc/udev/rules.d/70-persistent-net.rules

This is the article I came across. Although I didn't know what the CentOS equivalents were for these commands.

http://muzso.hu/2012/10/29/how-to-regenerate-the-etc-udev-rules.d-70-persistent-net.rules-file-on-debian-ubuntu

If you prefer not to reboot, just call this command after deleting that file.

service network restart
MacGyver
  • 1,864
  • 7
  • 37
  • 50