As of July 2019, the GUI for Ubiquiti's products still lacks proper IPv6 support (USG: 4.4.41 and UniFi Server 5.10.25).
Issue:
I wanted to use custom DNS servers, and NOT my ISP's DNS servers. For example, I wanted to use Google DNS and Cloudflare DNS, not the DNS servers provided by my ISP (Charter/Spectrum).
The UniFi management and USG's web interface allow you to enter in just IPv4 addresses for DNS.
When checking DNS from the USG, I would see something like this:
admin@UniFiRouter:~$ show dns forwarding nameservers ----------------------------------------------- Nameservers configured for DNS forwarding ----------------------------------------------- 1.1.1.1 available via 'system' 8.8.8.8 available via 'system' 2607:f428:ffff:ffff::1 available via 'system' 2607:f428:ffff:ffff::2 available via 'system'
The IPv4 addresses are correct (Google & Cloudflare), but the IPv6 addresses are what Charter has provided.
Since there is nothing in the GUI to specify IPv6 DNS, you have to create a json file to specify DNS and the IPv6 equivalent of "name-server no-update" DHCP option (so that the router does not use the ISP-provided DNS in addition to ones you specify).
I don't know why, but searching for something as simply as setting DNS didn't seem to get me the information I was looking for.
So here is the settings I used to specify DNS servers via custom config.gateway.json:
{ "interfaces": { "ethernet": { "eth0": { "dhcpv6-pd": { "no-dns": "''" } } } }, "system": { "name-server": [ "1.1.1.1", "8.8.8.8", "2606:4700:4700::1111", "2001:4860:4860::8888" ] } }
For my Cloud Key setup, I put the file here:
/srv/unifi/data/sites/default
(If you're not using the Cloud Key or have more than one site configured, please refer to the UniFi documentation on where to place your json file.)
I changed the owner of the file to ubnt:ubnt, then forced a re-provision of the USG so that it would load the json file. After a reboot, I got what I wanted:
admin@UniFiRouter:~$ show dns forwarding nameservers ----------------------------------------------- Nameservers configured for DNS forwarding ----------------------------------------------- 1.1.1.1 available via 'system' 8.8.8.8 available via 'system' 2606:4700:4700::1111 available via 'system' 2001:4860:4860::8888 available via 'system'
You can use whatever IP addresses you want, such as a locally-ran DNS server (including Pi-hole).