Oracle 8i | Oracle 9i | Oracle 10g | Oracle 11g | Oracle 12c | Miscellaneous | PL/SQL | SQL | Oracle RAC | Oracle Apps | Linux

Dnsmasq : For Simple DNS Configurations

Dnsmasq is a simple way to set up a DNS server for a small network, rather than going to the trouble of configuring BIND.

Related articles.


The Dnsmasq service is installed from a Yum repository using the following command.

# yum install dnsmasq

Turn on the Dnsmasq server and make sure it starts automatically on reboot.

# service dnsmasq start
# chkconfig dnsmasq on

Dnsmasq is configured by altering the contents of the "/etc/dnsmasq.conf" file and the contents of the "/etc/hosts" file.

The service can be stopped, started and restarted using the following commands.

# service dnsmasq stop
# service dnsmasq start
# service dnsmasq restart


If you are using the Linux firewall, you need to open port 53 specifically.

For the iptables firewall, use the following commands.

# iptables -I INPUT -p tcp --dport 53 -j ACCEPT
# iptables -I INPUT -p udp --dport 53 -j ACCEPT
# service iptables save

For the firewalld firewall, use the following commands to open the port for the current runtime and permanently to persist through reboots.

# firewall-cmd --zone=public --add-port=53/tcp
# firewall-cmd --zone=public --add-port=53/udp

# firewall-cmd --permanent --zone=public --add-port=53/tcp
# firewall-cmd --permanent --zone=public --add-port=53/udp


You don't need to do any specific DNS configuration as Dnsmasq will use the contents of the "/etc/hosts" to resolve any name requests. Anything it can't find there will be forwarded to the nameservers listed in the "/etc/resolv.conf" file.

For example, adding the following entries to the "/etc/hosts" file on the server running Dnsmasq, will allow it to act as a DNS, resolving those names.

# Oracle Linux 6 - RAC Installation   ol6-112-rac1.localdomain            ol6-112-rac1   ol6-112-rac2.localdomain            ol6-112-rac2   ol6-112-rac1-priv.localdomain       ol6-112-rac1-priv   ol6-112-rac2-priv.localdomain       ol6-112-rac2-priv   ol6-112-rac1-vip.localdomain        ol6-112-rac1-vip   ol6-112-rac2-vip.localdomain        ol6-112-rac2-vip   ol6-112-scan.localdomain            ol6-112-scan   ol6-112-scan.localdomain            ol6-112-scan   ol6-112-scan.localdomain            ol6-112-scan

Any machines in the network that need to use this DNS server for name resolution need their "/etc/resolv.conf" file amended so the "nameserver" entry points at this server.

search localdomain

For more information see:

Hope this helps. Regards Tim...

Back to the Top.