DHCP in VMware Server
I need to run a virtual machine on my work computer that provides DHCP services on a host-only network. Unfortunately, VMWare Server on Linux does not provide any mechanism for turning its DHCP services off.
Luckily, I found an article that addresses turning DHCP on or off for all host-only networks on the VMWare Server. I commented on that article with a technique for controlling DHCP on a per-network basis for host-only networks. I since have expanded on that with a patch for /usr/lib/vmware/net-services.sh that further refines the controls:
--- net-services.sh 2008-03-06 11:08:41.000000000 -0500
+++ /usr/lib/vmware/net-services.sh 2008-03-06 11:15:27.000000000 -0500
@@ -694,9 +694,22 @@
exitcode=$(($exitcode + $?))
elif [ -n "$hostaddr" -a -n "$netmask" ]; then
vmware_create_vmnet "$vHubNr"
+ # default to providing DHCP for hostonly networks
+ VMWARE_HOSTONLY_DHCP=yes
+ # VMWARE_HOSTONLY_DHCP can be set in /etc/vmware/services
+ # to turn DHCP on or off in every hostonly vmnet
+ if [ -f '/etc/vmware/services' ]; then
+ source '/etc/vmware/services'
+ fi
+ # VMWARE_HOSTONLY_DHCP can be set in /etc/vmware/vmnet?/services
+ # to turn DHCP on or off in a specific hostonly vmnet
+ # this setting overrides the global and default settings
+ if [ -f '/etc/vmware/vmnet'"$vHubNr"'/services' ]; then
+ source '/etc/vmware/vmnet'"$vHubNr"'/services'
+ fi
vmware_bg_exec 'Host-only networking on /dev/vmnet'"$vHubNr" \
vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" \
- "$hostaddr" "$netmask" 'yes'
+ "$hostaddr" "$netmask" "$VMWARE_HOSTONLY_DHCP"
exitcode=$(($exitcode + $?))
eval 'nat="$vmdb_answer_VNET_'"$vHubNr"'_NAT"'