I am looking for an reliable, scriptable method to 1) install a kvm guest using the default network and 2) ssh from the host to the guest to perform machine maintenance (e.g. yum update).
Ideally, this would be done by providing a host name for the guest during install (e.g. virt-install --name <myname> …), and then by ssh’ing to the machine using the provided hostname (e.g. ssh <myname>) and a username/password or preconfigured certificate.
The trouble I am having is with ssh’ing from the host to guest machine.
1. I can’t (easily) use the guest hostname, as the host isn’t automatically configured to resolve guest names.
2. I can’t (easily) use the guest IP address (e.g. read from /var/lib/libvirt/dnsmasq/default.leases), as the IP addresses are dynamic and can change when the guest is reinstalled (which I am doing a fair amount, at least in testing).
3. I can’t (easily) assign the guest a static IP address, as the default network configuration assumes all IP addresses in the range can be dynamically allocated, and thus a statically assigned IP might conflict.
I can work around these issues in a variety of unfortunate ways. But I wonder if there is something elegant I am missing.
If not, this would be a very nice feature for the future….