Remembering that the NAS is at 192.168.1.37 and the printer at 192.168.1.52 works as long as there are three devices. Then addresses change, someone gets a digit wrong and the browser bookmark stops working. Naming the devices on a home network is simpler than it seems, but there are a few choices to make carefully.
Three ways to get local names
On a home network, names can come from different mechanisms, which often coexist:
- mDNS (multicast DNS): every device announces its own name with the
.localsuffix. - Router DNS: the router records the names of devices that obtain an address via DHCP and resolves them for the whole network.
- Dedicated local DNS: a DNS server at home, often the same one that filters ads, with names you choose.
mDNS and the .local suffix
With mDNS no server is needed. When a computer looks for nas.local, it sends a question to the whole local network; the device with that name answers with its own address. It is the mechanism used by Bonjour on macOS and iOS, by Avahi on Linux, and it is also supported by recent versions of Windows.
Advantages:
- it works without configuring anything;
- it underpins automatic discovery of printers, speakers and streaming devices.
Limits:
- it works only within the same network: multicast packets do not cross routers or VLANs without a dedicated repeater;
- not every device supports it, especially older embedded ones;
- two devices with the same name create conflicts, solved by adding a number, for example
nas-2.local.
The .local suffix is reserved for mDNS. Using it in the router's regular DNS as well is a classic mistake: some systems route it only to mDNS and ignore the DNS server, with inconsistent results from one device to another.
The router's DNS
Many routers automatically record the name each device reports when it requests an address. Typing the short name, for example printer, is enough and the router answers. It is convenient, but it depends on how each device introduces itself: generic names like "android-3f2a" or duplicates are common.
Two precautions improve things considerably:
- give important devices a DHCP reservation, so their address does not change;
- rename devices from the router interface or from their own settings, choosing descriptive names.
The home.arpa domain
If you want a local DNS with full names, you need a suffix. For years people used made-up suffixes such as .lan, .home or .casa, with the risk that one day they would become public domains. For home networks there is a domain reserved by the standards bodies precisely for this purpose: home.arpa. It will never be assigned on the Internet and systems know it must be resolved locally.
An example naming scheme:
router.home.arpa 192.168.1.1
nas.home.arpa 192.168.1.10
printer.home.arpa 192.168.1.20
photos.home.arpa 192.168.1.10
In the router's DHCP settings, set home.arpa as the search domain: devices will complete the short name themselves, so nas becomes nas.home.arpa.
Using a subdomain of your own domain
A valid alternative, if you own a domain, is to use a subdomain such as home.yourdomain.tld for internal names. The advantage is being able to obtain valid TLS certificates for home services through DNS validation; the drawback is having to manage carefully what is public and what is not.
Bringing order: a recommended scheme
In my work, for a home with about ten fixed devices, I suggest this organisation:
| Element | Choice |
|---|---|
| Internal suffix | home.arpa, or a subdomain of your own domain |
| Fixed devices | DHCP reservation plus explicit DNS name |
| Mobile devices | No fixed name, DHCP only |
| Automatic discovery | mDNS left on for printers and casting |
| Documentation | Up-to-date table with name, IP and role |
Checking that it works
To understand where an answer comes from, you can use two different commands:
nslookup nas.home.arpa
ping nas.local
The first queries the configured DNS server; the second, on a system with mDNS support, uses multicast resolution. If one works and the other does not, you know which mechanism to check.
In short
- mDNS and
.localwork without a server, but only within the same network. - Do not use
.localin the router's DNS: it is reserved for mDNS. - For a local DNS choose home.arpa or a subdomain of your own domain.
- DHCP reservations and descriptive names make the whole network stable.
- Use nslookup and ping to see which mechanism is answering.