Hey! Listen! This post is part of a series on the Ubiquiti EdgeRouter Lite. Check them all out!

Date URL Part
2019-06-28 Migrating away from the Ubiquiti EdgeRouter Lite Migrated to a Netgate SG-1100
2019-02-03 EdgeRouter CNAME records Setup CNAME records
2017-10-03 Dyn DDNS on EdgeRouter Setup DynDNS
2017-04-25 DuckDNS on EdgeRouter Setup DuckDNS
2017-01-08 Ubiquiti EdgeRouter serial console settings Serial console settings
2016-11-29 Ubiquiti UniFi controller setup on Raspberry Pi 3 Install UniFi Controller
2016-08-30 EdgeRouter Lite Dnsmasq setup Setup dnsmasq
2016-06-13 EdgeRouter Lite software upgrade Firmware upgrade
2016-05-12 EdgeRouter Lite OpenVPN setup OpenVPN server setup
2016-04-29 Ubiquiti EdgeRouter Lite setup Initial setup


One of my only complaints about the EdgeRouter Lite is the usage of the Internet Systems Consortium (ISC) DHCP server. My main issue is that the DHCP server does not integrate with the DNS server. Because of this, DHCP names/leases are not automatically added to DNS. This topic has been addressed a few times before (here, herehere, here, and here).

However, with the release of the v1.9.0 EdgeMax software (you can use my software upgrade guide), Ubiquiti offers the use of dnsmasq. Based on a script by the forum user final, the dnsmasq script has been incorporated into v.1.9.0, but only at the command-line, no GUI usage is setup yet. With dnsmasq, when you give a specific host a static lease, the host will be added to DNS, by name, automatically.

ISC vs dnsmasq

With both ISC and dnsmasq, you would need to specify a static lease for each device.

set service dhcp-server shared-network-name LAN subnet static-mapping device1 ip-address
set service dhcp-server shared-network-name LAN subnet static-mapping device1 mac-address 'XX:XX:XX:XX:XX:XX'

However, ISC does not add the above entries to DNS (which dnsmasq does). Because of this, you’ll need to add each device to DNS (if you’re using ISC).

set system static-host-mapping host-name device1.<yourdomain> inet
set system static-host-mapping host-name device1.<yourdomain> alias device1

If you want to use ISC, but don’t want to set the static-host-mapping entry for each device, you can set the /etc/hosts file to automatically update with DNS entries. However, that’s a lot of adding/subtracting from the hosts file, and there have been reports that expired leases aren’t deleted from the hosts file.

set service dhcp-server hostfile-update enable

Instead, I’m going to switch to dnsmasq. I’ve used it on OpenWrt, DD-WRT, and Linux, so I prefer it. The caveats of dnsmasq (in Ubiquiti’s current implementation) are outlined below.

  • One of the advantages of using dnsmasq is that, if DNS forwarding is also configured, the “name resolution for local hosts” function is integrated, and the “hostfile-update” setting for the ISC DHCP implementation is not needed (it is ignored when use-dnsmasq is enabled).
  • When use-dnsmasq is enabled, DHCP server will serve the “listen-on” interfaces configured under “service dns forwarding”, or all interfaces if that is not configured.
  • Since some of the existing DHCP server config settings are specific to the ISC DHCP implementation (e.g., the failover settings, the “free-form” parameters settings), those will be ignored when use-dnsmasq is enabled.
  • If “free-form” parameters for dnsmasq are needed, they can be entered under DNS forwarding config, e.g., “set service dns forwarding options …”.
  • When use-dnsmasq is enabled, the “authoritative” setting is not “per-shared-network”, i.e., “authoritative” will be enabled if it is set under any shared-network.
  • When use-dnsmasq is enabled, the entries configured under “static-mapping” will be translated to statically assigned A records in dnsmasq (using the dnsmasq host-record directive). If a client with a static-mapping entry sends a DHCP request with a different client-name, that client-name will be ignored.
  • Currently use-dnsmasq only handles “configuration”, and status reporting (including show commands in the CLI and the leases display in the Web UI for example) is not supported yet.

Enable dnsmasq

For dnsmasq to be setup properly, you need to have DNS setup to listen on certain interfaces, otherwise it will listen on all interfaces. You should also set the nameserver to the localhost (so dnsmasq is used first), then forward queries to external DNS servers. This setup is described in my initial setup, and also shown below.

set service dhcp-server shared-network-name LAN subnet dns-server
set service dns forwarding listen-on eth1
set service dns forwarding cache-size 400
set system name-server
set service dns forwarding name-server
set service dns forwarding name-server

Next, you need to set a local domain name, as shown below.

set system domain-name home.lan

Then, enable dnsmasq.

set service dhcp-server use-dnsmasq enable


At this point (you may need a reboot), you should be able to ping your devices by hostname (as configured in the static-mapping section, above).

--> ping rpi01_lan
PING rpi01_lan.home.lan ( 56(84) bytes of data.
64 bytes from rpi01 ( icmp_req=1 ttl=64 time=0.404 ms
64 bytes from rpi01 ( icmp_req=2 ttl=64 time=0.373 ms
64 bytes from rpi01 ( icmp_req=3 ttl=64 time=0.310 ms

You should also be able to access any device via its name, instead of IP.


Hope this helps!



Old comments from WordPress