I have set up multiple virtual machines with libvirt and kvm on Ubuntu server 20.04, which work just as expected. The only thing I cannot figure out at this point is how to make their hostnames resolvable between the guests and from the host, at the moment I can only access them via their ip addresses which I can get from
virsh net-dhcp-leases default.
I'd like to access the virtual machines by their hostname or similar both from the host and from within the virtual machines, as relying on these ip addresses is a bit inconvenient, but am not sure how to achieve this. I have tried following articles such as this. If a host is named
test I want it to be reachable by both
external.example.com is not resolved to an internal address, but an external one possibly somewhere else, which I think could be a problem with the solution in the article above. Would this be best achieved by adding entries manually in the hosts
/etc/hosts or by something similar in the article above? I have tried adding entries to the
/etc/hosts/ file but the entries have only worked on the host machine, but I assume that it is because I haven't properly set up dnsmasq or something similar.
Any help will be appreciated, since I am very much a confused beginner and it is quite overwhelming.