Cloning Or Converting Linux VM From VMWare Workstation To ESX Server: ETH0 Gone. ETH1 Available?
I ran into a fun situation yesterday. I downloaded a virtual appliance for the Agilo Trac Plugin (which, if you’re a Trac user and trying to do sprints or iterations with it, you need to get this. It’s free and it rocks.) Turns out this VM is a Debian distribution. (I’m certainly no linux guru, but I can usually find my way around.)
Starting up the VM on my local VMWare Workstation worked fine. The distro is configured for DHCP, and my VM network bridged to my box, found the company network and found an IP for the VM. You can see the IP show up in the screen shot below:
After playing with the Agilo app for a few minutes, I wanted to share it with my coworkers and get their opinions. Fortunately for me, I’ve been helping the company grow a rather nice VMWare ESX Server infrastructure for our development needs. So, I thought the easy thing to do would be to migrate the VM up to a server and make it available.
I go through the “Export” process from VMWare Workstation and send it up to a server with no problems. I configured a static IP address in the /etc/network/interfaces file, as described in this article. However, when I get the server based VM up and running again, I run into a problem:
Note the first error circled: “eth0: error fetching interface information: Device not found”. And the second error circled: no ip address!!! That’s not good… how am I supposed to get to the box without an IP address… so, I check the network adapters through ifconfig to see if I can get eth0 back up.
No luck – “eth0: ERROR while getting interface flags: No such device”
Checking ifconfig, i see that there’s only an “eth1” configured in the vm.
After some serious hair-pulling-out frustration, several coworkers not having any clue, and a general sense of doom and gloom; I managed to pull some serious google-fu out, and found this post. The information provided looked like what I needed:
– the kernel in Lenny is newer and has a driver that is missing (or not
fully functional for your hardware) on the other system
– the new card was assigned eth1 because the previous card’s mac address
is still listed in the database of persistent ethernet device names_
_Boot the problematic system and run “/sbin/ifconfig”. If you see the
3Com NIC listed as eth1 then you can edit the file </p>
to assign **eth0 to it. (Remove or comment out the entry for the old NIC.) </em></blockquote>
As it turned out, the conversion process from local VMWare workstation up to VMWare ESX Server caused the virtual NIC’s MAC Address to change. So I go hunting for the file they talk about, and it’s not there. Fortunately, it was only a few characters off from my debian box:
looking at the contents of this file, I found the system’s configuration for all of the network adapters, and noticed that there are two of them in my file:
but I know that the VM only has one virtual NIC. so, following the advice from the post above, I comment out the current “eth0” and rename “eth1” to “eth0”.
Reboot the box and it works!