Create a DNS record on a Unifi Security Gateway

Assuming you’ve enabled DNSMasq on your Unifi Security Gateway, you may wish to create local DNS records.

EDIT: these records and options seem to be overwritten after a short period. Investigating why.

EDIT: Ah-ha. The trick is to save the override file on your Unifi Controller:

[root@unifi ~]# cat /usr/local/share/java/unifi/data/sites/default/config.gateway.json
{
  "system": {
    "static-host-mapping": {
      "host-name": {
        "vinz": {
          "inet": [
            "192.168.1.11"
          ],
          "alias": [
            "smtp",
            "netdata"
          ]
        },
        "frank": {
          "inet": [
            "192.168.1.12"
          ]
        }
      }
    }
  },
  "service": {
    "dns": {
      "forwarding": {
        "options": [
          "expand-hosts"
        ]
      }
    }
  }
}