Help: get Guest OS ip address from host

Discussions related to using VirtualBox on Linux hosts.
Post Reply
virtualpier
Posts: 12
Joined: 2. Jan 2009, 12:52
Primary OS: Ubuntu 8.04
VBox Version: OSE Debian
Guest OSses: Linux, Windows
Location: Italy

Help: get Guest OS ip address from host

Post by virtualpier »

Hi all,

with the following command i can get the local IP address of a Windows Guest:
$VBoxManage guestproperty enumerate myWinVM | grep "V4/IP" | cut -d"," -f2 | cut -d":" -f2 | tr -d " "
192.168.0.126
Here is the "full row":
$ VBoxManage guestproperty enumerate myWinVM | grep "V4/IP"
Name: /VirtualBox/GuestInfo/Net/0/V4/IP, value: 192.168.0.126, timestamp: 1251719828889115000, flags:
But... this command doesn't seems to work on a Linux Guest with Guest Additions loaded (lsmod -> vboxadd) :/

Any advice?
Do you know an alternative way to get that ip from the virtualizion linux host?

Thanks
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Help: get Guest OS ip address from host

Post by Sasquatch »

Works fine for me. I did notice that it can take a little while before it's known. If you boot the VM, you have to wait for the GA to report the IP address. I tried it on a VM that wasn't even turned on (though it was set to NAT) and it reported 10.0.2.15 just fine. The offline VM did run recently, other VMs that are turned off for a while don't show the information.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
virtualpier
Posts: 12
Joined: 2. Jan 2009, 12:52
Primary OS: Ubuntu 8.04
VBox Version: OSE Debian
Guest OSses: Linux, Windows
Location: Italy

Re: Help: get Guest OS ip address from host

Post by virtualpier »

Thanks for your reply,

but, that command doesn't work for me with a linux (ubuntu) VM :/
(uptime more than 20 hours).

When i execute the first part of the command (VBoxManage guestproperty enumerate myLinuxVM) i get only:
VirtualBox Command Line Management Interface Version 2.1.4
...
All rights reserver.

Name: /VirtualBox/HostInfo/GUI/LanguageID, value: C, timestamp: 123......, flags:
Is there something i can do to make it work? :P


Thanks
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Help: get Guest OS ip address from host

Post by Sasquatch »

Now tell me, if I have a Linux VM, called Xubuntu, why do I get a result?

Code: Select all

VBoxManage guestproperty enumerate Xubuntu | grep "V4/IP" | cut -d"," -f2 | cut -d":" -f2 | tr -d " "
10.0.2.15
Something is wrong with your VM I think. Are you sure the GA are running? Are they actually installed? You get the IP config no matter what Guest you're running, as long as the GA work in it.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
virtualpier
Posts: 12
Joined: 2. Jan 2009, 12:52
Primary OS: Ubuntu 8.04
VBox Version: OSE Debian
Guest OSses: Linux, Windows
Location: Italy

Re: Help: get Guest OS ip address from host

Post by virtualpier »

I suppose that something is wrong with my VMs, ok, but what?

i've tried to reinstall GA:
# ./VBoxLinuxAdditions-amd64.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 2.1.4 Guest Additions for Linux installation...........................................................................................................................................................................................................
VirtualBox 2.1.4 Guest Additions installation
Building the VirtualBox Guest Additions kernel module...
Building the shared folder support kernel module...
Installing the VirtualBox Guest Additions...

Could not find X.org or XFree86 on the guest system. The X Window drivers
will not be installed.
# lsmod | grep vbox
vboxvfs 61384 0
vboxadd 106784 2 vboxvfs
GA should be installed in the right way, isn't it?
What can i do to understand where the problem is?

Thanks
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Help: get Guest OS ip address from host

Post by Sasquatch »

Maybe updating to a more recent version of VB? Who knows, there could be a bug in it that prevents Linux Guests from reporthing it's IP address and it's fixed in a newer release (use 2.2.4 or 3.0.4). I'm running 3.0.4 btw, hence the difference in results.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply