How to disable the DHCP server on VMware Fusion 3

VMware Fusion 3 on Mac offers three kinds of networking: bridged, NAT and host-only.

When using host-only networking, VMware Fusion runs a DHCP server for you on the virtual network “vmnet1“. By default, this daemon hands out IP addresses in the 172.16.115.0/24 network.

There are no settings in Preferences to configure or disable the DHCP server. This causes problems when trying to run your own virtualized DHCP server or PXE boot environment on the host-only network.

The VMware DHCP server can be disabled either temporarily or permanently. For a temporary fix (until you restart Fusion), end the DHCP server process. Open a Terminal window and type:

    sudo kill -15 `sudo cat /var/run/vmnet-dhcpd-vmnet1.pid`

To permanently disable the DHCP server, you need to change one line in /Library/Application Support/VMware Fusion/networking. This file normally looks like this:

    VERSION=1,0
    answer VNET_1_DHCP yes
    answer VNET_1_DHCP_CFG_HASH D06F14D2911502FA261951B0F568992FEC46C8B3
    answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
    answer VNET_1_HOSTONLY_SUBNET 172.16.115.0
    answer VNET_1_VIRTUAL_ADAPTER yes
    answer VNET_8_DHCP yes
    answer VNET_8_DHCP_CFG_HASH 9894EC355205C9C006F1BE90320DF38FEE4CC80A
    answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
    answer VNET_8_HOSTONLY_SUBNET 172.16.178.0
    answer VNET_8_NAT yes
    answer VNET_8_VIRTUAL_ADAPTER yes
    add_bridge_mapping en0 2

Quit VMware Fusion, run “sudo vi /Library/Application Support/VMware Fusion/networking” and change the highlighted line to read:

    answer VNET_1_DHCP no

Reboot your Mac or run “sudo /Library/Application Support/VMware Fusion/boot.sh --restart” to activate the changes.

References:

CFengine3 tip: “Redefinition of a constant variable”

The CFengine3 learning curve is steep and slippery.

Let’s say you want to define a default policy for your hosts, and a more specialized policy for certain hosts. Your implementation might look like this:

  # CFengine3 Test Policy
  body common control
  {
    bundlesequence => { "test" };
  }

  bundle agent test
  {
  vars:

    "base_list" slist => { "one", "two", "three" },
                comment => "All systems can count one-two-three";

  redhat::
    "list" slist => { "@(base_list)", "four" },
           comment => "Red Hat breed systems can count to four.";

  myhost::
    "list" slist => { "zero", "@(base_list)", "four" },
           comment => "My host is special, it starts counting from zero.";

  reports:

  Yr2010::
    "Counting: $(list)";
  }

If you run the above example, you will see error messages like this:

  !! Redefinition of a constant variable "list"

The default behavior for variables is to behave like constants, i.e. to not allow re-definition of that same variable (see CFengine 3.0.5 Reference Guide, section 6.1.7).

If you set the proper “overridable” policy on all instances of the “list” variable, the error messages go away:

  # Test policy
  body common control
  {
    bundlesequence => { "test" };
  }

  bundle agent test
  {
  vars:

    "base_list" slist => { "one", "two", "three" },
                comment => "All systems can count one-two-three";

  redhat::
    "list" slist => { "@(base_list)", "four" },
           comment => "Red Hat breed systems can count to four. Make this overridable.",
           policy => "overridable";

  myhost::
    "list" slist => { "zero", "@(base_list)", "four" },
           comment => "On this host, we start counting from zero.",
           policy => "overridable";

  reports:

  Yr2010::
    "Counting: $(list)";
}