Site icon Bytefreaks.net

How to setup DNS service for DHCP-enabled KVM guests

Advertisements

So you’ve set up KVM on your machine and you have installed a few guests to run on top, now it’s the time to access them.

Since KVM can run without a GUI, you might want to control these guests from the command line. But, how can you do it if you do not know the IP of the guests?

You can either connect to the guest using virt-viewer:

virt-viewer -c qemu:///system $MACHINE &

which requires more bandwidth since it will open up a VNC session.

Or, use ssh to connect using the guest’s name, like this:

ssh $MACHINE

which doesn’t require that you know the IP beforehand.

To achieve this, access guest machines using their hostname only, you can do the following: Edit /etc/resolv.conf and add the line nameserver 192.168.122.1 right after the search entries .

Your file should look something like this afterwards:
domain in.bytefreaks.net
search in.bytefreaks.net
nameserver 192.168.122.1
nameserver 194.44.13.20
nameserver 194.44.13.58
nameserver 194.44.13.11

Then you are ready to go! No restarts needed no extra steps.

NOTES:

This post is also available in: Greek

Exit mobile version