doggo - prettier dig replacements written in go.

Setting up alternative DNS for specific clients on Unifi EdgeRouters

If you have a situation where you want a specific device to have different DNS than the rest of the machines on a subnet, here is what you do:

  1. Go to http://<EDGEROUTER_IP:PORT>/#Services/DHCP/Server and create a static IP for the device.

Let’say this is what my DHCP screen looks like in Edgerouter:

  1. ssh into the Edgerouter with something similar to ssh ubnt@<EDGEROUTER_IP>.
  2. Enter configure at the shell.
  3. Take a look at the existing settings with show service dhcp-server

If there is an existing “option domain-name servers” setting already, let’s delete it.

The format is:

delete service dhcp-server shared-network-name <DHCP-NAME subnet <SUBNET> static-mapping <DEVICE-NAME> static-mapping-parameters

An example command would be:

delete service dhcp-server shared-network-name eth2_dhcp subnet 192.168.200.0/0 static-mapping Bedroom_ROKU static-mapping-parameters

Let's add a DNS mapping now.

The format is:

 
set service dhcp-server shared-network-name <DHCP-NAME> subnet <SUBNET> static-mapping <DEVICE-NAME> static-mapping-parameters "option domain-name-servers <DNS-IP 1>, <DNS-IP 2> ;"

You don’t have to enter two DNS entries, one works fine if you don’t want redunancy.

Then my command would look like this:

set service dhcp-server shared-network-name eth2_dhcp subnet 192.168.200.0/24 static-mapping Bedroom_ROKU static-mapping-parameters "option domain-name-servers 8.8.8.8, 8.8.4.4 ;"
  1. Type in ‘commit’ and then ‘save’

You can see this change added to doing cat /opt/vyatta/etc/dhcpd.conf or show service dhcp-server.

Reconnect your device to the network (or reboot).