4

I'm trying to get vm ip address with VBoxManage guestproperty enumerate <vm_name>

but get this result :

Name: /VirtualBox/HostInfo/GUI/LanguageID, value: en_US, timestamp: 1592898609729744000, flags: RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxVerExt, value: 6.1.6_Ubuntu, timestamp: 1592898565935338001, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/VMInfo/ResumeCounter, value: 0, timestamp: 1592898564265851000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepExec, value: , timestamp: 1592898564265851000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostGuest/SysprepArgs, value: , timestamp: 1592898564265851000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/VMInfo/ResetCounter, value: 0, timestamp: 1592898564265851000, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxRev, value: 137129, timestamp: 1592898565935338002, flags: TRANSIENT, RDONLYGUEST
Name: /VirtualBox/HostInfo/VBoxVer, value: 6.1.6, timestamp: 1592898565935338000, flags: TRANSIENT, RDONLYGUEST

but vm has ip address and I can ping it from host

user@user:~$ ping 192.168.88.120
PING 192.168.88.120 (192.168.88.120) 56(84) bytes of data.
64 bytes from 192.168.88.120: icmp_seq=1 ttl=64 time=1.04 ms
64 bytes from 192.168.88.120: icmp_seq=2 ttl=64 time=0.642 ms
Alex Bravo
  • 1,601
  • 2
  • 24
  • 40
klevchenko
  • 41
  • 4
  • Host OS: Mac OS, Guest OS Ubuntu 20.04 ```$ VBoxManage guestproperty enumerate mcs | grep IP Name: /VirtualBox/GuestInfo/Net/0/V4/IP, value: 192.168.1.202, timestamp: 1591676322850257000, flags: Name: /VirtualBox/GuestInfo/Net/3/V4/IP, value: 172.18.0.1, timestamp: 1591676322873524000, flags: Name: /VirtualBox/GuestInfo/Net/2/V4/IP, value: 172.17.0.1, timestamp: 1591676322853129000, flags: Name: /VirtualBox/GuestInfo/Net/1/V4/IP, value: 192.168.1.122, timestamp: 1591676322852744000, flags: ``` – Rob Raymond Jun 24 '20 at 16:43

2 Answers2

0

Need to install guest additions first to see guest info using that command

0

There is an answer that might help, if you have a Linux host. My host is Windows 11 and I use the PowerShell and WSL Ubuntu. I don't have guest additions installed and can only see the MAC address.

On WSL Linux:

:/mnt/c/Program Files/Oracle/VirtualBox$ ./VBoxManage.exe showvminfo $vmname | grep MAC

Or on PowerShell:

& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo $vmname | findstr MAC

For some reason, arp on WSL only gives me one entry. But running arp -a on the PowerShell might show the corresponding IP for the MAC. If not, we scan for open SSH ports, since the VM is ready for SSH.

On WSL Linux:

# You could also run it without any filters for an interesting result
nmap 192.168.178.* -p 22 | grep open -B 5

The output is something like:

Nmap scan report for nice.hostname (192.168.178.30)
Host is up (0.0012s latency).

PORT   STATE SERVICE
22/tcp open  ssh

That should narrow down the list of IPs to try. The good thing is that after this, the ARP table might also be updated, so I can now see it by running arp -a on PowerShell.

If the list is too long, you can convert the MAC into the same format, as in the following example, or you could just insert the -s manually.

Powershell:

PS > "0800279A49B6" -replace '..(?!$)', '$&-'

And then use it to filter the list in PowerShell, for example:

> arp -a | findstr -i 08-00-27-9A-49-B6
  192.168.178.30        08-00-27-9a-49-b6     dynamic

And there you have it, the IP address of the virtual machine. If you still cannot see the IP address after this, or if your VM doesn't show up on the nmap scan, there's a good chance that the VM has not finished booting.

Nagev
  • 10,835
  • 4
  • 58
  • 69