Ubiquiti makes nice routers with good firmware. But one missing feature; it doesn’t generate local hostnames in DNS for clients on DHCP. Ie, my Linux server registers itself with the name “gvl”. But I can’t then “ssh gvl” on my network because gvl isn’t a valid DNS name, not even in the Ubiquiti.
The right solution for this is to enable dnsmasq to be your DHCP server. dnsmasq is already running as a DNS server in the router; all this does is let it also be the DHCP server. As a side effect you now have nice DNS service. The downside here is it requires some slight tomfoolery to enable and then you end up with a less-than-standard router. See the discussion here.
Another possible solution is to enable the “hostfile-update” option. This tells the stock DHCP server to write entries in /etc/hosts. There’s some possible bugs with this.
The hacky solution for this is to leave DHCP alone and just create a static IP address and DNS name for your host. I’m too lazy to post screenshots, but basically…
- Boot your DHCP client that you want to give a DNS name to. Let it take an automatic address.
- In the web GUI for the router, go to Services / DHCP Server. Click the little “Actions” dropdown button and select “View Leases”.
- Find your DHCP client and click “Map Static IP”. This computer (well, MAC address) will now get a static IP every time it boots.
- Go to Config Tree. Open system / static-host-mapping / host-name.
- Click “Add”. Type a hostname. Click update list.
- In the config tree look under host-name for your new name. Click it, then under “inet” add a field which is the IP address you set up in step 3.
- Click “Preview” to verify the config is right. It should be something like this. If it looks right, Apply it.
set system static-host-mapping host-name gvl inet 192.168.3.75
- Test DNS on another system. dig @192.168.0.1 gvl any
Steps 4-8 can also be done via the command line configurator, which is probably less clumsy than the config-tree GUI.
Now that I’ve typed all this out I think perhaps switching to dnsmasq for DHCP is the better solution. But this works as a one-off.