A tip or two for VMware Fusion (OS X) guest networking

Before I get into this post too far, yes, I’m now a Mac user. Not exactly a fanboy yet, but my new employer let me choose between a Windows laptop and a MacBook for my work computer, so I chose–wisely. I’d been using Ubuntu on an HP laptop (ugh to HP) for a few years, so it seemed like a chance to try something new at no cost to me, which is my favorite cost.

As you can see from my other posts about virtualization, I’m a big fan of Virtualbox, but this post is about VMware Fusion, which was provided to me with my MacBook.

On to the tips…

I’ve been creating a testing environment for tacacs+ servers for a Cisco networking environment as well as Puppet server management, and I’m horrible with remembering IP addresses, unless there’s a very distinct pattern. When you use NAT in Fusion, addresses are assigned to guests VMs via DHCP in an automatically generated scope. The problem is, every time you boot your server you may get a new DHCP address! That sucks.

What to do?

You could create reservations, like this post and this post suggest, but since I’m eventually going to import the VMS I create into an ESXi host, it doesn’t hurt me to configure the guest’s network statically, as long as I know the range I can use for my guests.

If I look at my Mac’s dhcp.conf,

macbook:~ me$ more /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf

I see:

subnet netmask {
option broadcast-address;
option domain-name-servers;
option domain-name localdomain;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
option netbios-name-servers;
option routers;

I see that the DHCP scope for my NAT network doesn’t completely consume the whole /24 network–it only uses the “bottom” half. So, if I statically assign my guests addresses in the “top” half of the /24 network, my guests will still be on the same network.

So, if I configure my Ubuntu guest’s /etc/network/interfaces like this

iface eth0 inet static

and add an entry to my MacBook’s /etc/hosts like this

# my local VMs guest01

my MacBook knows how to find guest01 by name, not just IP address!

macbook:~ me$ ping guest01
PING guest01 ( 56 data bytes
64 bytes from icmp_seq=0 ttl=64 time=0.345 ms
64 bytes from icmp_seq=1 ttl=64 time=0.233 ms
--- guest01 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.233/0.289/0.345/0.056 ms

When I’m ready to import/convert my Fusion guest into our ESXi host, I just need to edit the guest’s /etc/network/interfaces again with the new IP address information.


Leave a Reply