2

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.

2 Answers 2

3

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.

0

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

You must log in to answer this question.

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