Discussion:
[ubuntu-us-mi] IP address of VM running in bridge mode
Robert Citek
2009-07-30 19:06:58 UTC
Permalink
I've started up a headless VirtualBox VM in bridged networking mode so
that it has an IP address from the network DHCP server. ?That is, this
VM appears as just another machine on the network of hundreds of
machines. The host is running virtualbox-ose 2.1.4-dfsg-1ubuntu3 on
Ubuntu 9.04 and the guest is Ubuntu 8.10. From using VBoxManage, I
know the guest VM's MAC address.

Given that I do not have access to the DHCP server, is there a way to
find out what the guest VM's IP address is, perhaps using some kind of
tool on the host machine?

So far googling and looking through the manual have not been fruitful,
although I could be overlooking something obvious.

Regards,
- Robert
Jeff Hanson
2009-07-30 20:15:44 UTC
Permalink
Post by Robert Citek
I've started up a headless VirtualBox VM in bridged networking mode so
that it has an IP address from the network DHCP server. ?That is, this
VM appears as just another machine on the network of hundreds of
machines. ?The host is running virtualbox-ose 2.1.4-dfsg-1ubuntu3 on
Ubuntu 9.04 and the guest is Ubuntu 8.10. ?From using VBoxManage, I
know the guest VM's MAC address.
Given that I do not have access to the DHCP server, is there a way to
find out what the guest VM's IP address is, perhaps using some kind of
tool on the host machine?
So far googling and looking through the manual have not been fruitful,
although I could be overlooking something obvious.
The obvious would be ping or nslookup but are you looking to determine
what guest is on a particular host by IP?
Robert Citek
2009-07-30 20:46:26 UTC
Permalink
Post by Jeff Hanson
The obvious would be ping or nslookup but are you looking to determine
what guest is on a particular host by IP?
Right. The brute-force method would be to ping the entire subnet and
then lookup the MAC in the arp table. Fortunately, I'm on a class-C
subnet so it wouldn't be too big a problem. But I was hoping for a
more general solution that could also be used on a class-A network.

Yes, the goal is to figure out the IP address of the guest VM.

Regards,
- Robert
Jeff Hanson
2009-07-30 21:31:27 UTC
Permalink
Right. ?The brute-force method would be to ping the entire subnet and
then lookup the MAC in the arp table. ?Fortunately, I'm on a class-C
subnet so it wouldn't be too big a problem. ?But I was hoping for a
more general solution that could also be used on a class-A network.
You only need to do that if you don't know the guest hostname or don't
have a (reliable) DNS server. The MAC of a guest will be in the vmx
file as "ethernet0.generatedAddress".
Robert Citek
2009-07-31 04:54:38 UTC
Permalink
Post by Jeff Hanson
Post by Robert Citek
Right. The brute-force method would be to ping the entire subnet and
then lookup the MAC in the arp table. Fortunately, I'm on a class-C
subnet so it wouldn't be too big a problem. But I was hoping for a
more general solution that could also be used on a class-A network.
The following worked but I find it rather inelegant:

mac=aa:bb:cc:dd:ee:ff
netip=192.168.10.0
class=24
nmap -p 22 ${netip}/${class} > /dev/null
arp -an | grep -i ${mac}
Post by Jeff Hanson
You only need to do that if you don't know the guest hostname or don't
have a (reliable) DNS server. The MAC of a guest will be in the vmx
file as "ethernet0.generatedAddress".
Just to clarify, I'm looking for the IP address instead of the MAC
address. Also, I'm using VirtualBox instead of VMware, which does use
a .vmx file to store its configuration. With VirtualBox the MAC
address can be discovered by using 'VBoxManage list vms'.

So, my question is, given the MAC address of the guest, does
VirtualBox provide a method to discover the IP address of a guest VM
that is running headless?

Regards,
- Robert

Jay R. Wren
2009-07-30 21:34:11 UTC
Permalink
Lease negotiation will probably have it communicating with the DHCP server
rather often (far more often than lease expiration time). Sniff that
traffic.

$ sudo tshark port 67 or port 68

You will then see request responses.

--
Jay

--------------------------------------------------
From: "Robert Citek" <robert.citek at gmail.com>
Sent: Thursday, July 30, 2009 4:46 PM
To: "Ubuntu Michigan Local Community Team" <ubuntu-us-mi at lists.ubuntu.com>
Subject: Re: [ubuntu-us-mi] IP address of VM running in bridge mode
Post by Robert Citek
Post by Jeff Hanson
The obvious would be ping or nslookup but are you looking to determine
what guest is on a particular host by IP?
Right. The brute-force method would be to ping the entire subnet and
then lookup the MAC in the arp table. Fortunately, I'm on a class-C
subnet so it wouldn't be too big a problem. But I was hoping for a
more general solution that could also be used on a class-A network.
Yes, the goal is to figure out the IP address of the guest VM.
Regards,
- Robert
--
ubuntu-us-mi mailing list
ubuntu-us-mi at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-us-mi
Flavio daCosta
2009-07-30 20:29:28 UTC
Permalink
Perhaps an easier way exists, but I would just sniff it:

# Make a way to send a packet to the machine
# where 192.168.0.123 is an un-used IP on the network
# and aa:bb:cc:dd:ee:ff is the mac of the host.
sudo arp -s 192.168.0.123 aa:bb:cc:dd:ee:ff

# Sniff in another window
sudo tcpdump -n -p icmp

# Send a packet and wait for the response (in the tcpdump window)
ping 192.168.0.123


ymmv
Loading...