Thursday, February 12, 2015

Deploying smart DNS Server with (dnsmasq) for KVM guests in RHEL7



Sometimes is necessary set up a smart dns server without too much complications for local virtualizaton environments (labs).

Scenario: Red Hat Enterprise Linux 7 x86_64
Host: KVM Hypervisor / libvirt / virt-manager


(1) - First set up your hosts in /etc/hosts (in the host kvm), here register all the hosts(guests) that you want resolve in your internal lab:

# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4

192.168.122.120    demo.example.com demo

(2) - Search for PID of dnsmasq (in the host kvm) and the configuration file, in my case (/var/lib/libvirt/dnsmasq/default.conf)


# ps -ef | grep -i dnsmasq | grep -v grep
nobody    2629     1  0 13:42 ?        00:00:00 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf


(3) - Add your internal doamin(example.com) to dnsmasq server:

# echo "local=/example/" >> /var/lib/libvirt/dnsmasq/default.conf

(4) - Restart the process and check /var/log/messages

# kill -HUP 2629


...

Done!!!






1 comment:

  1. Corrigindo o último comando: # kill -HUP 2629

    Correto: # kill -YUPPY 2629

    ReplyDelete