Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using xen virtualization with a dhcp server. Whenever I create a new VM an ipaddress is assigned by the dhcp server. I'm working remotely and have to use only command line, so logging into the VMs I create is a pain without knowing the ipaddress (static ip is not allowed). Is there an elegant way to find the ipaddress of the vm before logging into it?

Currently I use nmap to scan the port and take my best guess at the open ssh ports.

share|improve this question
up vote 2 down vote accepted

If you're assigning IP addresses with a DHCP server then you can read the leases file to see which addresses have been leased to which MAC addresses. You can set a static MAC address for the Xen domain in its config file.

For example, with ISC DHCP on Debian you will find the leases file at /var/lib/dhcp3/dhcpd.leases

On many DHCP server implementations you can also have it send a DNS update when it acknowledges a lease, so if you configure your DNS infrastructure properly you can just connect by host name.

Also on some DHCP server implementations you can have a script execute when a lease is acknowledged, so you could work something out with that.

share|improve this answer

I run Xen with Fedora Domain0 and use libvirt managed dnsmasq for dhcp. My leases are found in /var/lib/libvirt/dnsmasq/default.leases

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .