Thursday, September 21, 2006

Moving a VM from Player to Workstation

This post is just a shout out to anyone using the Windows version of VMWare to create virtual machines hosting Ubuntu.

I started out using VMWare Workstation to create a VM hosting Ubuntu Linux. Once I got it working, I decided to cheap out, uninstall VMWare Workstation and install VMWare Player instead. It worked like a charm. The VM played in Player with no hiccups, but I had to deal with that annoying bar across the top of the screen - which, when you're trying to demo Ubuntu, can be a real pain. Plus, after a while, I decided I wanted to open the VM in Workstation (or Server) again to make some changes and make use of the snapshots feature.

So I uninstalled Player, reinstalled Workstation and ran the VM. Problem - the internet connection was lost. Being pretty new to VMWare, I didn't know what virtual network settings could cause my symptoms, but I suspected that moving from Player back to Workstation screwed things up. I was right, but I didn't know why. I read a bunch of forum entries online and all my settings looked good. I tried to break the NAT virtual settings (I need NAT to fool the network I'll be connecting to that I'm a Windows box), hoping that breaking it would force VMWare to repair itself. Nope. So I put everything back the way I found it (which fixed nothing) and was about to give up.

Running out of things to try, I deactivated, then reactivated my eth0 network interface in Ubuntu. Bingo! Internet connection returned. But I had no idea why. Was this a one time thing? Did I inadvertently break and repair my NAT virtual network device? Nope.

When you reinstall VMWare Workstation, the software randomly picks a new virtual IP network address range. So for example, when I originally created the VM, the software picked 192.168.25.128 as the IP for the Ubuntu VM (using NAT). Which always worked fine. But when I reinstalled VMWare, the software picked a new random address range, and gave the VM let's say 192.168.39.128. The VM however, is still trying to use the original address because as far as it's concerned, the lease hasn't expired. Which is why deactivating then reactivating the Ubuntu network interface fixed the problem. I essentially forced Ubuntu to forget the current lease and get a new one, which it did - which makes everything work just fine.

No comments: