I wanted to write up a quick post of a few hurdles I went through with P2V’ing a linux web server that was also running cPanel. The P2V process worked as expected, however upon the first boot of the VM, I had issues with network connectivity. The P2V Linux server network config did not come over as expected. Let me walk you through a few of the issues.
P2V Linux server network config
When running a plain old ifconfig on the VM, this is the output I saw:
As you can see, I didn’t have any interfaces listed besides the loopback interface. At first when seeing this, I had driver issues running in my mind but let’s do some further checking. What gives? Well, I started diving in with a few handy commandline tools. Let’s see what ip link show gives us.
ip link show
As you can see above, I do have interfaces besides just the loopback. So at this point I know that it is not a driver issue. The interfaces ARE there.
Okay, so let’s go back to the basics. Let’s compare what the interfaces look like on the physical server to the interfaces on the VM. Do you see a difference below? The interface names are different on the physical server compared to the VM. Upon boot, these were enumerated differently on the VM after it came up.
So the next step is to rename the interfaces on the VM (eth0 and eth1) back to the eth2 and eth3 of the physical box to match the original configuration and hopefully get everything back up and running.
To do that we edit the following file:
Simply scroll to the end of the device line that correlates to your vmnic and you will see the “NAME=”eth0″ or whatever name it currently is. You can simply update the name of the interface to what you want it to be.
- Edit the file
- Save the file
- Reboot for changes to take effect.
So I knew I had just found the silver bullet and I would see devices. However, after rebooting I still did not see any devices besides the loopback interface when issuing ifconfig.
However, I remembered, this was a P2V. So, the MAC address contained in the configuration file for the interface wouldn’t match the new MAC address of the VMware vmnic. Is that hunch correct? Let’s see. All we have to do is look at the directory:
Edit the configuration file for the interface you are interested in. In my case, it is the ifcfg-eth3 file. Now let’s look at the MAC address, which is noted as HWADDR.
Sure enough! The MAC address I had in the eth3 configuration file which came across in the P2V doesn’t not match the new VMware MAC address (which you can find in the VM configuration properties and clicking on the Network Adapter in question). So now, all I have left to do is change the MAC address, reboot and see if I can get the network to come up.
After rebooting and running the ip link show command. Voila! At last, network interface is showing as UP. Just to verify, I am also now able to ping the box and have connectivity with the other devices on the network.
Be sure to include in your P2V time and plan of action, reconfiguring your network as P2V Linux server network config may not come across. Due to the incorrect enumeration of the devices as well as to change the MAC address(es) most likely you may need to perform some if not all the steps mentioned above to once again have network connectivity, however, mileage may vary depending on your initial configuration as well as what you are trying to accomplish. In my case, having the identical configuration on the target VM was necessary.