yaakov.online

yaakov.online


I fight with computers

mDNS Name Resolution in Linux

If there's one thing I love being able to do on my home network, it's resolving host names.

Traditionally Windows, macOS and Linux have never really spoken the same language and without a DHCP+DNS server it becomes difficult to track what hosts have which IP addresses.

RFC 6762 defines the .local top-level domain for link-local addressing via multicast DNS - the general term for what Apple call "Bonjour".

macOS supports this natively. Windows either does natively, or does once iTunes is installed - I haven't tested without iTunes, but all my PCs have iTunes so it really doesn't matter to me. Even my NAS supports it.

I recently installed Ubuntu Server on my new NUC and it turns out that you can get the same support on Linux via Avahi, a free and open-source implementation of mDNS/DNS-SD.

I wanted to get Ubuntu to:

  1. Respond to mDNS queries for <hostname>.local
  2. Be able to query other hosts on the network via <hostname>.local

It turns out all you have to do on a Debian-based OS is:

sudo apt install avahi-daemon  

After installing Avahi, I can do two-way mDNS lookup. For example:

[12:25pm [email protected]:~] ssh coruscant.local ping Eadu.local
PING Eadu.local (192.168.0.12) 56(84) bytes of data.  
64 bytes from 192.168.0.12 (192.168.0.12): icmp_seq=1 ttl=64 time=1.08 ms  
64 bytes from 192.168.0.12 (192.168.0.12): icmp_seq=2 ttl=64 time=3.01 ms  
^C
[12:25pm [email protected]:~] 

Here my MacBook, Eadu, managed to resolve coruscant.local (the Ubuntu machine), which in turn resolved Eadu.local and send ICMP ping packets to the MacBook.

Easy peasy, and no DNS management required.