Articles | Contact

Configure Dnsmasq to resolve local host names on the Edgerouter X

Dnsmasq can be enabled to also provide the DHCP service on the Edgerouter X. Its DHCP server integrates with the DNS server and allows local machines with DHCP-allocated addresses to appear in the DNS. To do this we will enable Dnsmasq set service dhcp-server use-dnsmasq enable.



DHCP Server Using Dnsmasq

This part configures the DHCP server to use Dnsmasq and to have Dnsmasq to resolve local hosts names. A lot of the settings comes from this article, and also with some input from this thread.

Start with having the DHCP server to use Dnsmasq with set service dhcp-server use-dnsmasq enable. Then we want to set a domain name for the range of the DHCP server set service dhcp-server shared-network-name LAN subnet 192.168.1.0/24 domain-name lan.

After this we are add some options to the DNS forwarding. At edit service dns forwarding we do options domain-neededthat sets the Dnsmasq to only forward internet domains to the DNS servers. Otherwise Dnsmasq will try to resolve the domain towards etc/hosts or DHCP. With set options no-hosts Dnsmasq won't read hosts from etc/hosts if we want locals domains to resolve towards DHCP.