All of lore.kernel.org
 help / color / mirror / Atom feed
* Best way to get IP addresses from VMs without logging in to them?
@ 2014-06-11 16:32 Russ Pavlicek
  2014-06-11 16:38 ` Ian Campbell
  2014-06-11 16:40 ` Andy Smith
  0 siblings, 2 replies; 13+ messages in thread
From: Russ Pavlicek @ 2014-06-11 16:32 UTC (permalink / raw)
  To: xen-devel

I have been working on an "on-ramp" application to introduce new
people to Xen Project (more on that later), when I ran into a simple
scenario which seems to lack a simple solution:

When I start up a new VM which employs DHCP, how can I
programmatically determine what IP address it obtained?

When I look at the Wiki, I find the following reference:

http://wiki.xenproject.org/wiki/Xen_FAQ_Networking#IP_Determination

Which suggests using tcpdump for sniffing out packets relating to a
known MAC address.  But that depends on traffic flow from VM, which
could be time consuming if the machine happens to be idle.

I devised the following bash script which uses nmap to determine the
correlation of MAC address to IPv4 address in a Class C network with a
known subnet root:

# Use nmap to find the IP of the MAC address:
ADDRLINE=`nmap -sn $IPROOT.1-254 | egrep -i $MACADDR -B 3 | egrep $IPROOT`
IPADDR=${ADDRLINE#*(}
ADDRLINE=${IPADDR%)*}

It works, but it is clunky (and currently limited to Class C networks).

Is there a better way to programmatically do this?  If so, we need to
document it in the Wiki (and I'd be glad to work on that).  But how
can we do this simply?

Thanks,

Russ

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-06-12  8:19 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-11 16:32 Best way to get IP addresses from VMs without logging in to them? Russ Pavlicek
2014-06-11 16:38 ` Ian Campbell
2014-06-11 16:49   ` Andrew Cooper
2014-06-11 17:47     ` Russ Pavlicek
2014-06-11 18:02       ` Andrew Cooper
2014-06-11 18:14       ` Ian Campbell
2014-06-11 18:36         ` Russ Pavlicek
2014-06-11 18:44           ` Andrew Cooper
2014-06-11 22:10             ` Don Slutz
2014-06-12  7:26             ` Ian Campbell
2014-06-12  8:19               ` Tamas Lengyel
2014-06-11 16:40 ` Andy Smith
2014-06-11 16:49   ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.