Controlling DHCP for VMWare Fusion VMs

Posted Monday 8th March, 2010

This week I built a brand new Mac for work. This meant I also needed to install VMWare Fusion and knock up a couple of virtual machines for development. Everything was working as expected until I tried using the same VMs at home, and discovered a complete lack of connectivity to—and within—the VMs, despite having active network and internet access on the host OS. After a little investigation, I discovered the issue:

When I’ve used VMWare Fusion in the past, my VMs have all been assigned IPv4 addresses in the range through, via DHCP (the 20-bit block of RFC1918). This has always suited me fine, and has meant I’ve been able to assign host file mapping entries for those IP addresses with relative confidence since the addresses have never changed, even after reboots.

However, on the new Mac, I was surprised to find my VMWare VMs being assigned IPv4 addresses in the range through (the 16-bit block of RFC1918). As you can imagine, this could cause a certain degree of havoc if you’re LAN is also assigning DHCP IP addresses in that range. This is exactly what was happening in my case—and on both my work LAN and my home LAN—so VMWare was having to change the IPs each time I changed network.

To fix this issue, all I needed to do was tell VMWare to use a specific range of IP addresses when assigning DHCP. Unfortunately, VMWare doesn’t make this particularly easy (despite including a handy network configuration script). So here’s what you have to do…

A quick word on VMWare Fusion networking

Before I jump in with the “how to”, let me just take a moment to explain how networking works in VMWare Fusion:

VMWare sets up two network interfaces during installation, plus a bridge from Fusion to your host’s active network interface. The two network interfaces that are configured are “vmnet1”–the host-only network–and “vmnet8”–the NAT network interface. It is the latter of the two that we need to configure for control over VM DHCP.

Resetting the network configuration

Firstly, make sure you have shut down all your VMs (even the headless ones), and that the VMWare GUI isn’t running. We’ll also need to make sure, before we start our configuration, that we’re in a predictable state for all the configuration files used by VMWare. Handily, VMWare Fusion supplies a network interface configuration script that will allow us to do exactly that.

VMWare records a bunch of information–in regard to DHCP and the vmnets–in a file called “locations”. To begin with, we’ll need to delete that file so that it is regenerated later:

$ cd /Library/Application\ Support/VMWare\ Fusion/
$ rm -f locations

Following that, we run the handy configuration Perl script, which will automatically answer it’s own questions with the default answers:

$ sudo ./

Configuring a NAT network for vmnet8.

‘ping’ -q -t 10 > /dev/null status = 2
The subnet appears to be unused.

The file /Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf that this program was about to install already exists. Overwrite? [yes]

The file /var/db/vmware/vmnet-dhcpd-vmnet8.leases that this program was about to install already exists. Overwrite? [yes]

The file /var/db/vmware/vmnet-dhcpd-vmnet8.leases~ that this program was about to install already exists. Overwrite? [yes]


I haven’t included all the output here, but it continues on for a while.

Once you have a prompt again, it’s time to restart the network services with these update values (even though they’re not going to be final):

$ sudo ./ --restart

This will give you a “Shutting down VMware Fusion:” message, followed by a “Starting VMware Fusion:” message.

Once you get your prompt back, make sure the network interfaces have been set up correctly by running the interface configurator:

$ ifconfig


vmnet8: flags=8863 mtu 1500
        inet netmask 0xffffff00 broadcast
        ether 00:50:56:c0:00:08
vmnet1: flags=8863 mtu 1500
        inet netmask 0xffffff00 broadcast
        ether 00:50:56:c0:00:01


You should see something like the above, even if the addresses are slightly different. As long as the vmnet8 and vmnet1 interfaces are showing, we’re up and running again.

Defining your IP range

Remember that “locations” file we junked earlier? That’s where we need to define our IP ranges so that the network configuration script can work its magic. Following our little clean-up, that file should now be nice and simple, and ready for our changes. To do that, you’ll need to edit with root permissions:

$ mate locations

I’m using TextMate, which will prompt me for my admin password when I save the file. If you’re using an editor like vi or vim, you’ll need to sudo:

$ sudo vim locations

The settings you need to define in the locations file are as follows:


I defined mine like so, with the third digit matching the vmnet to which it is assigned, just so I have a point of reference if I need it:


Once we’ve saved our changes, we simply need to reset the network configuration using the same Perl script as earlier:

$ sudo ./

Configuring a NAT network for vmnet8.

Configuring a host-only network for vmnet1.

The host-only network is currently configured to use the private subnet Do you want to keep these settings? [yes]

Finally, restart VMWare Fusion daemons and reconfigure the network interfaces:

$ sudo ./ --restart

Once that is complete, VMWare is configured to use your defined range of IP addresses for both its vmnets. You can check this by running the interface configurator again:

$ ifconfig
vmnet8: flags=8863 mtu 1500
        inet netmask 0xffffff00 broadcast
        ether 00:50:56:c0:00:08 
vmnet1: flags=8863 mtu 1500
        inet netmask 0xffffff00 broadcast
        ether 00:50:56:c0:00:01


So now you can configure your vmnets in VMWare Fusion to use a predictable range of IP addresses. That, as they say, is that.

Included in: Development, Mac OS X, Networking, Reference, Tools, Tutorials, Virtualisation


  1. Accessibility
  2. Agile
  3. Ajax
  4. Apache
  5. API
  6. Architecture
  7. Books
  8. Browsers
  9. CMS
  10. CouchDB
  11. CSS
  12. Design
  13. Development
  14. Django
  15. Email
  16. Events
  17. Gaming
  18. Grammar
  19. Hardware
  20. HTML
  21. HTTP
  22. Humour
  23. Idea
  24. Information Architecture
  25. JavaScript
  26. jQuery
  27. Lean
  28. Life
  29. Linux
  30. Literature
  31. Mac OS X
  32. Management
  33. Meme
  34. Microformats
  35. Monday
  36. MySQL
  37. Networking
  38. News
  39. Personal
  40. Photoshop
  41. PHP
  42. Process
  43. Python
  44. Reference
  45. REST
  46. Science
  47. SEO
  48. Server
  49. Site
  50. Sitepimp
  51. Social
  52. Spelling
  53. Syndication
  54. Testing
  55. The Future
  56. Thoughts
  57. Tools
  58. Tutorial
  59. Tutorials
  60. Typography
  61. UI
  62. UNIX
  63. Virtualisation
  64. Web
  65. Web Standards
  66. Widgets
  67. Wii
  68. Writing
  69. Xbox
  70. XHTML