P2V Linux server network config
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.
Physical box:
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:
/etc/udev/rules.d/70-persistent-net.rules
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.
Steps:
- Edit the file
- Save the file
- Reboot for changes to take effect.
More Troubleshooting
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:
/etc/sysconfig/network-scripts
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.
Final Thoughts
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.