I prefer to use local virtual machines for development. And running a fully-configured Ubuntu machine on VMWare Fusion has been the most flexible way of doing that.
I also like to have separate entries for each hostname in my Mac’s
/etc/hosts so that I can easily demo the work via screensharing applications like Google Hangout, Join.me and WebEx, which work best on the host.
Here is a snippet of my
One thing that used to bother me was how the IP address for the VM would change every time I started it. I knew I could setup a host-only network, but I also wanted the ability to connect to the internet. Finally, I found a solution: setup two networks, one that is shared with my Mac and one that is host-only.
Here are my two network devices on the VM settings page:
Here are the details of the host-only network (if you expand “Advanced options” at the bottom, you will see the Mac address):
Next, we need to setup the static IP address for the host-only network. In order to do that, we need to edit the DHCP configuration file for that network:
As shown in the title bar of the images above, the name of my VM is “Ubuntu1204”. So, here is my entry at the bottom of the above file:
After modifying the DHCP settings for a network, we have to refresh the VM network (or restart it):
VMWare will now assign a static IP address for the VM. But I will need to force the DHCP client to renew my VM’s IP address.
In the VM, release the current IP for the network-only interface (eth1):
This is what the response will look like:
Now, obtain a new IP: