Tuesday 22 January 2008

How to disable host only networking dhcp server on Linux hosts

Disabling the VMware DHCP Service on the Host Computer.

It is easy enough to do this on Windows hosts, this article focuses on Linux hosts.

Follow the steps shown below for your host operating system.

Linux for Workstation 5.x and VMware Server 1.x

  1. Open the file /usr/lib/vmware/net-services.sh in a text editor.
  2. Locate the following section (lines 697-699, as seen in Workstation 5.5.1, build 19175):
    vmware_bg_exec 'Host-only networking on /dev/vmnet'"$vHubNr" \
    vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" \
    "$hostaddr" "$netmask" 'yes'
  3. Change yes to no. The resulting section should look like this:
    vmware_bg_exec 'Host-only networking on /dev/vmnet'"$vHubNr" \
    vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" \
    "$hostaddr" "$netmask" 'no'
  4. Save the file.
  5. As root, run /usr/lib/vmware/net-services.sh restart to restart the service.

Linux for Workstation 6

  1. As root, stop VMware services using /etc/init.d/vmware stop
  2. Open the file /etc/vmware/locations in a text editor.
  3. Scroll all the way to the bottom.
  4. Look for answer VNET_1_DHCP yes, change this to answer VNET_1_DHCP no
  5. Continue for any other interfaces that you would like to disable DHCP.
  6. Save the file.
  7. As root, start VMware services using /etc/init.d/vmware start

8 comments:

Randall Wood said...

Here's a modification that allows you to turn DHCP on or off per vmnet? interface for host-only networks:

VMWARE_HOSTONLY_DHCP=yes
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" "$VMWARE_HOSTONLY_DHCP"

Change the line mentioned in the article to the above lines and then you can create a file or files at /etc/vmware/vmnet?/services with the line VMWARE_HOSTONLY_DHCP=no to turn off DHCP for that vmnet? interface

Anonymous said...

One workaround is to create a bridged interface with a non-existent ethernet interface (dummy0).

Anonymous said...

I have linux ubuntu 7.10 with vmware server 1.0.6 and this solution don't work :

Linux for Workstation 5.x and VMware Server 1.x
Open the file /usr/lib/vmware/net-services.sh in a text editor.
Locate the following section (lines 697-699, as seen in Workstation 5.5.1, build 19175):
vmware_bg_exec 'Host-only networking on /dev/vmnet'"$vHubNr" \
vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" \
"$hostaddr" "$netmask" 'yes' -->
Change to "no".

The resulting section should look like this:
vmware_bg_exec 'Host-only networking on /dev/vmnet'"$vHubNr" \
vmware_start_hostonly "$vHubNr" 'vmnet'"$vHubNr" \
"$hostaddr" "$netmask" 'no'
Save the file.
As root, run /usr/lib/vmware/net-services.sh restart to restart the service.

Thanks

Anonymous said...

I have find a solution to disable dhcp server in vmware server 1.0.6 :

launch script :
/usr/bin/vmware-config.pl

In this question :

Do you want to be able to use NAT networking in your virtual machines? (yes/no) [yes] no <-- ANSWER, VERY IMPORTANT

Thanks

Anonymous said...

I have find a solution to disable dhcp server in vmware server 1.0.6 :

launch script :
/usr/bin/vmware-config.pl

In this question :

Do you want to be able to use NAT networking in your virtual machines? (yes/no) [yes] no <-- ANSWER, VERY IMPORTANT

Thanks

David B said...

I have had similar problems with 1.0.6

if you don't turn off your vmware server all that often, you can kill the process from console

first you will need to find the process, you can do that in most Linux GUI's with a process monitor, then look for vmnet-dhcpd. Then kill the process called vmnet-dhcpd.

With no GUI, and using the console, or through ssh etc. type in 'ps aux | grep vmnet-dhcpd', the process id will then be shown, then type 'kill ####' and the dhcp daemon will be killed. The process id is the first number after the name of the user who started up the daemon, in my case, root.

eg.

xpclientx2:/mnt/VMs # ps aux | grep vmnet-dhcpd

root 12208 0.0 0.0 1828 308 ? Ss 07:54 0:00 /usr/bin/vmnet-dhcpd -cf /etc/vmware/vmnet1/dhcpd/dhcpd.conf -lf /etc/vmware/vmnet1/dhcpd/dhcpd.leases -pf /var/run/vmnet-dhcpd-vmnet1.pid vmnet1

root 12212 0.0 0.0 3064 712 pts/0 R+ 07:55 0:00 grep vmnet-dhcpd

xpclientx2:/mnt/VMs # kill 12208

It's only a band-aid approach, but the good thing is, it won't matter what version it is, or if they modify the scripts again in future, as long as the dhcp daemon is seperate.

Anonymous said...

One thing I did to remove DHCP from a single vmnet was to edit /etc/vmnet<#>/dhcp/dhcp.conf (in my network it was vi /etc/vmnet8/dhcp/dhcp.conf) and remark out all of the lines. Then I ran
# /usr/lib/vmware/net-services.sh restart and it appears to disable the DHCP since it doesn't know what network to serve IPs for.

Lunchbox said...

In vmware-server 201, they finally gave us a choice!

I think if we change the statement like "answer VNET_1_DHCP" in /etc/vmware/locations from "yes" to "no", it seems to no longer start the daemon. Code near /usr/lib/vmware/net-services.sh:700, where I used to disable the start by hand, seems to support this new config.

Sure makes THAT easy for me.