Skip to main content
2 of 2
Updated with details about using mDNS.
Ingo
  • 42.6k
  • 20
  • 85
  • 205

You are using the .local DNS top-level domain. This domain is reserved for multicast DNS (mDNS) mostly used for Link-local addresses and defined not be be served by any DNS server. This is managed by avahi and implies that there is no DHCP server present on the subnet and there is no DNS server serving the .local top level domain. All devices on the subnet have ip addresses from the subnet 169.254.0.0/16.

The local DNS resolver is managed with the file /etc/resolv.conf. You can tell the resolver to always append a default domain if the queried DNS name isn't full qualified. These options are

domain Local domain name
search Search list for host-name lookup

For its specific use look at man resolv.conf. This way you can omit typing the domain name .local.

But there is a problem with modifying /etc/resolv.conf. This file is mostly modified by resolver configuration programs like resolvconf or openresolv or systemd-resolved.service to manage changed DNS server entries on mobile devices. They will always overwrite your settings in resolv.conf. You have to determine what configuration options of that programs will set domain and/or search entries in resolv.conf.

If you do not use a resolver configuration program you can just edit /etc/resolv.conf.

UPDATE:
I have learned that the description above is the default behavior with DNS name resolution but .local is a special top level domain that do not follow this. It is used as an parallel service to DNS with DNS server. Any DNS query for a name ending with .local MUST be sent to the mDNS IPv4 link-local multicast address 224.0.0.251. (2)

The .local domain should not be used when setting up DNS infra-structures. So a query to a DNS infra-structure should never give an answer. Most applications use glibc's Name Service Switch to decide how host names are looked up. This is configured in /etc/nsswitch.conf and has a special entry for mDNS which ensures that a .local query is never asked to DNS server. For detailed info about this look at (1).

All together: you will not get an answer if you try to search a DNS infra-structure for the domain .local. The domain name itself is used to distinguish between mDNS and DNS infra-structure. You cannot omit it.

References:
(1) - Can not resolve .local domains internal to my office LAN - Answer 1
(2) - Can not resolve .local domains internal to my office LAN - Answer 2

Ingo
  • 42.6k
  • 20
  • 85
  • 205