I would like to configure a machine image with all the bells and whistles and then be able to launch multiple instances of it in VirtualBox. However, it allows me to launch only a single instance of each VM. I tried cloning VMs (and selecting reinitialize MAC address) and launching the clones, however, the clone doesn't get an IP address. So the original has the following network configuration:
>ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:92:0a:ec
inet addr:192.168.103.49 Bcast:192.168.255.255 Mask:255.255.0.0
inet6 addr: fe80::a00:27ff:fe92:aec/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5317 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:516671 (516.6 KB) TX bytes:10492 (10.4 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:337 (337.0 B) TX bytes:337 (337.0 B)
whereas the clone has no eth0
, only lo
and I cannot ssh into it.
Best Answer
Update
I was able to re-create your issue exactly. The easiest solution I found was to simply remove the contents of
/etc/udev/rules.d/70-persistent-net.rules
and reboot. This file is automatically generated when you reboot and it will reset eth0 to the MAC currently assigned.Original Answer
When you clone a VM and reinitialize the mac the OS thinks the new mac is a new network device. It usually assigns the new mac address to eth1. If eth1 has not been configured properly you won't have any networking and wont be able to ssh in.
You can clear the udev networking rules to force the OS to forget about the previous MAC and assign the new MAC to eth0, or you can configure eth1 to be the primary networking interface.
Here is a pretty good explaination of why udev rules are important and applicable to your situation: "For example, on a computer having two network cards made by Intel and Realtek, the network card manufactured by Intel may become eth0 and the Realtek card becomes eth1. In some cases, after a reboot the cards get renumbered the other way around. To avoid this, create Udev rules that assign stable names to network cards based on their MAC addresses or bus positions."
Another possible problem would be if the IP address was statically set in the network configuration. If you have a DHCP server that is supposed to be handing out IP addresses then make sure the network configuration is set to DHCP.
quote source and udev rules documentation