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

Checking the state of a running VM and killing the process if required

Occasionally you may want to check the state of a virtual machine, to check whether it is running or not. On the very few times that VMotion failed for one reason or another, a VM will fail to resume on the source host or start on the destination host.

From the Service Console you can check the state of running machines by typing vmware-cmd //server.vmx getstate. You can also kill the VM if it is truly in a hung state by using the procedure below.

  • Login to the service console
  • You can check the VM state by typing vmware-cmd //server.vmx getstate
  • Type ps -ef | grep
  • The second column is your pid of the vmkload_app of the Virtual Machine, you can also type ps –eaf to see all running processes
  • Type kill -9
  • Check VM state again, it should now be off
  • Type vmware-cmd //server.vmx start to power on VM

Show hidden devices after P2V

After performing a P2V always remove the hidden physical hardware from the OS. This is particularly important for network cards that have the original IP address(es) that you want to assisgn to the new VM.

1. Click Start | Run | cmd

2. At a command prompt, type the following command , and then press ENTER:

set devmgr_show_nonpresent_devices=1

3. Type the following command in the same command prompt window, and then press ENTER:

start devmgmt.msc

4. Click Show hidden devices on the View menu in Device Managers before you can see devices that are not connected to the computer.

Syncing ESX Server with an external time source

To sync your ESX Server with an external NTP server, do the following at the ESX Server console... Basically you can do the following (replace with the IP Address of an NTP Server.)

Modify the /etc/ntp.conf file as follows:
Under the "# --- OUR TIMESERVERS -----" section create two lines as follows:
restrict mask 255.255.255.255 nomodify notrap noquery
server

Modify the /etc/ntp/step-tickers file and add your NTP Servers, each on their own line, to the file.

Enable the appropriate NTP client ports on the firewall.
/usr/sbin/esxcfg-firewall --enableService ntpClient

Restart the vmware-hostd process.
/sbin/service mgmt-vmware restart

To synchronize the system's time with the NTP server
/usr/sbin/ntpdate -q

To enable the ntp daemon to autostart when the server is rebooted
/sbin/chkconfig --level 345 ntpd on

Start NTP daemon
/sbin/service ntpd start

Set the local hardware clock to the NTP synchronized local system time
/sbin/hwclock --systohc

Ensure the time is accurate
/bin/date