DHCP on VMware Fusion
VMware Fusion is a wonderful thing. I am happily running three Linux instances at once under my MacBook with 4GB of RAM (though, as best I can tell, the mobo can actually only address 3GB of RAM).
One glitch that was driving me crazy, though, was that it seemed like DHCP leases were being allocated flakily to the guest machines. When you’re doing database replication, you can’t have master/slave IP addresses changing all the time. (And you certainly don’t want two machines with the same IP address!)
Some digging around turned this up. I don’t remember exactly where — I believe snippets of it were in an official VMware forum — but it was harder to find than it should have been. Hence my posting, to add another path to help those who need it.
On OS X, the file you need to change should be in /Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf. (vmnet8 is the virtual interface for NAT networking in the guest machines.) You should have a subnet clause in it already like this:
subnet 172.16.253.0 netmask 255.255.255.0 {
range 172.16.253.129 172.16.253.254;
option broadcast-address 172.16.253.255;
option domain-name-servers 172.16.253.2;
option domain-name "localdomain";
option routers 172.16.253.2;
}
Now, for each virtual machine, set up a new host clause, e.g. :
host ubuntu64-vm {
hardware ethernet 00:0F:FF:EF:00:00;
fixed-address 172.16.253.20;
}
Be sure to assign an IP address (fixed-address) outside the range specified in the subnet clause at top.
Get the Ethernet MAC address from ifconfig eth0 inside the guest machine, or from ~/Documents/Virtual Machines/GUESTMACHINENAME/GUESTMACHINENAME.vmx (it’s the line with ethernet0.generatedAddress).
Finally, restart the requisite VMware daemons by running
sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart
Theoretically Related Posts
Trackbacks
Use this link to trackback from your own site.

Could you have NAT’ed the VMs?
The VMs are NATted. That’s what the vmnet8 interface is for on the host machine; vmnet1 is for bridged. I needed DHCP reservations because I was running MySQL replication between two guest machines.
Did I understand your question correctly?
Thanks for the helpful post.
I’m in a similar position (Linux based development via VMware on a Mac Pro), and having static IPs keeps things nice and predictable.
Excellent post, very very helpful at just the right time. And since I already know ISC DHCP I can do other things (like modifying the domain name for convenience) too.
One note I had major difficulty with. I couldn’t get vmnet-dhcpd to offer static leases due to one really dumb type-o, and I bet I won’t be the only one.
The excellent example given here is good, but it doesn’t match the IP address range my VMware Fusion was using by default, and I stupidly used the same fixed addresses. Sadly, it seems ISC’s DHCPd will simply give out dynamic addresses if you try to use it to assign addresses for which it doesn’t have configured on it’s own interface.
For example, my vmnet8/dhcpd.conf had this in it:
subnet 192.168.216.0 netmask 255.255.255.0 {
range 192.168.216.128 192.168.216.254;
option broadcast-address 192.168.216.255;
option domain-name-servers 192.168.216.2;
option domain-name “localdomain”;
option routers 192.168.216.2;
}
And I was trying to follow the above example, so I did something like this:
# Static addresses for VMs - gbg, 5/24/2008
host dargo {
hardware ethernet 00:0c:29:56:74:65;
fixed-address 172.16.253.10;
}
And kept banging my head as over and over again it kept assigning a dynamic address from the 192.168.216.x range .. finally, after much debugging I finally figured out the trick:
host dargo {
hardware ethernet 00:0c:29:56:74:65;
fixed-address 192.168.216.10;
}
Now, it assigns it perfectly. Much thanks to thirdbIT for taking the time and effort to post this information, hopefully I can give something back if someone can learn from my stupid mistake.
Cheers,
Greg