Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.