How to find the IP address of VMware virtual machine

When you run a virtual machine (VM) created by VMware Player or VMware Server, there can be circumstances where you don't have console access to the VM. For example, you could be running your VM without VMware Player GUI, or you may have trouble opening a remote console from VMware Server. If you don't have access to VM console, you will need to remotely ssh to the VM by using its IP address. But how do you find out its IP address in the first place?

If you want to find the IP address of VMware VM, here is what you can do.

NAT networking

If your VMware VM is using NAT networking, VMware's internal DHCP server (dhcpd) from which the VM obtained its IP address is running on the VMware host. You can find DHCP lease info of dhcpd in the following location of the VMware host.

$ cat /etc/vmware/vmnet8/dhcpd/dhcpd.leases
lease {
        starts 5 2012/08/31 19:46:58;
        ends 5 2012/08/31 20:16:58;
        hardware ethernet 00:0c:29:72:77:c6;
        client-hostname "my-host";

As you can see above, the DHCP lease file contains a list of IP addresses that are leased out to VMs, and detailed lease info (including hostname). From this information, you can infer the IP address of your VM.

Bridged networking

If your VMware VM is using bridged networking, the VM gets its IP address from an external DHCP server running somewhere in your network. In this case, you can snoop on DHCP offer(s) sent to the VM from outside, to infer the IP address assigned to the VM. To do that, you first identify the MAC address of the VM from its .vmx file.

$ vi my_host.vmx
ethernet0.generatedAddress = "00:0c:29:bd:81:01"

As shown in the sample .vmx snippet above, the MAC address of a given VM is found in "ethernetX.generatedAddress" field.

Next, you can use a tool called dhcpdump to monitor DHCP traffic. dhcpdump captures DHCP packets, and shows DHCP activities in human-readable format. It also allows one to filter DHCP traffic based on receiving client's MAC address. Using this feature, you can capture DHCP OFFER messages being sent to the VM, which will contain the VM's potential IP addresses.

Install dhcpdump and run it with MAC address filtering on VMware host as follows.

$ sudo apt-get install dhcpdump
$ sudo dhcpdump -i eth0 -h ^00:0c:29:bd:81:01
  TIME: 2012-11-19 21:53:47.373
    IP: (0:e0:b1:cb:7:30) > (ff:ff:ff:ff:ff:ff)
HTYPE: 1 (Ethernet) HLEN: 6 HOPS: 0 XID: a06c6363 SECS: 0 FLAGS: 0 CIADDR: YIADDR: SIADDR: GIADDR: CHADDR: 00:0c:29:bd:81:01:00:00:00:00:00:00:00:00:00:00 SNAME: . ....

In the DHCP OFFER message as displayed by dhcpdump, the "YIADDR" field shows the IP address (e.g., offered to the VM.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

The following two tabs change content below.
Dan Nanni is the founder and also a regular contributor of He is a Linux/FOSS enthusiast who loves to get his hands dirty with his Linux box. He likes to procrastinate when he is supposed to be busy and productive. When he is otherwise free, he likes to watch movies and shop for the coolest gadgets.

Leave a comment

Your email address will not be published. Required fields are marked *