How to configure DNSmasq on Ubiquiti EdgeMax routers

Introduction:

DNSmasq for DHCP can be used as an alternative to ISC DHCPD as the backend for the EdgeRouter. The main advantage to using it is to speed up the resolution of local hostnames. This tutorial will show you how to configure it on the EdgeMax Routers.

Prerequisites:

Firmware 1.9.0 or higher

Step 1

Access the EdgeOS CLI either via the GUI or an SSH session

Step 2

Type configure when prompted to enter configuration mode.

Type set service dhcp-server use-dnsmasq enable and then commit, save and exit

Step 3

Type set system name-server 127.0.0.1 to allow a loop back to the route itself

Type set service dns forwarding name-server 8.8.8.8 to set Google's DNS to resolve all external resolutions

Set DNS Forwarding listen-on for all LAN interfaces (including VLANs) by typing set service dns forwarding listen-on eth1 then set service dns forwarding listen-on eth1.20

Optional: You can increase the dns forwarding cache by running the command set service dns forwarding cache-size 400. You would just change the 400 to your preferable cache size.

Step 4

Set System domain-name by typing set system domain-name home.local

Set a domain name for your DHCP servers by typing set service dhcp-server shared-network-name management subnet 10.0.100.0/24 domain-name home.local

If using a device,such as Cloudkey, you can set a static host mapping by typing set service dhcp-server shared-network-name Management subnet 10.0.100.0/24 static-mapping cloudkey ip-address 10.0.100.44

Step 5

Remember to type the commit command to save your changes. You can view your current DHCP leases by typing cat /var/run/dnsmasq-dhcp.leases.

More from Tutorials