ホーム 暮らし How .local works: The truth about mDNS and why you shouldn't trust it too much

How .local works: The truth about mDNS and why you shouldn't trust it too much

藤崎 健人 藤崎 健人 • 更新: • 公開: • 読了約 55 分
目次

Introduction

na391e15f2716

When I connected a GL.iNet router to my home LAN, I was able to access it from my browser using a hostname like gl-rm1.local, even though it had been assigned an IP address via DHCP.

How does this work?

I haven't set up a DNS server. I haven't made any special settings on the router either. So why can I resolve names using a .local hostname?

The answer lies in a mechanism called mDNS (Multicast DNS).

In this article, I will summarize from the perspective of a practitioner, covering the operating principles of mDNS, the official status of the .local domain, pitfalls due to differences in client-side implementations, and 'why you shouldn't trust it too much' in the context of FA (Factory Automation).

What is mDNS? - 'Serverless DNS'

Standard DNS is a client-server mechanism where a client queries a DNS server asking, 'What is the IP address for this hostname?' and receives a response.

mDNS is different; it does not require a DNS server. It uses multicast to ask every device on the same network segment, 'Who is this hostname?', and the corresponding device itself responds, 'That's me.'

The specific operation is as follows:

  1. A client attempts to access printer.local

  2. The OS name resolution mechanism detects the .local domain and processes it as mDNS

  3. It sends a query to the multicast address 224.0.0.251 (or FF02::FB for IPv6) on UDP port 5353

  4. All devices on the same segment receive this query

  5. The device registered as printer.local responds with its own IP address

The protocol format itself is almost identical to standard DNS; the only difference is that the destination is a multicast address rather than a DNS server. A records (IPv4) and AAAA records (IPv6) are used for hostname resolution, while PTR/SRV records are used in combination with RFC 6763 (DNS-SD) for service discovery (such as printer detection).

Rather than calling it a 'simplified DNS,' it is more accurate to call it 'a serverless version of DNS'.

What if there are two devices with the same name? - Name conflict detection (Probing)

A question arises here. If I connect two routers of the same model, won't both try to announce themselves with the same hostname (e.g., gl-rm1.local)?

RFC 6762 (Section 8.1) anticipates this case and defines a mechanism called Probing (name conflict detection). When a device joins a network, it first sends a probe packet via multicast to ask, "Is anyone using this hostname?" (three times at 250ms intervals after a random delay of 0–250ms). If a device already claims the same name, the newcomer must defer to the existing host and choose a new name (MUST defer / SHOULD choose new names).

However, the RFC does not specify exactly how to rename. Apple's Bonjour is known for appending a sequential number to the end, like gl-rm1-2.local, but this is merely an implementation practice; within the scope of RFC compliance, a user may manually reconfigure it.

However, there is a pitfall here.

The user is unaware that the name has changed. If you had gl-rm1.local written in your bookmarks or configuration files, and a second device takes that name, you might end up connecting to an unintended device.

Furthermore, whether Probing works correctly is also implementation-dependent. While robust implementations like Avahi handle conflict detection, some inexpensive IoT devices skip Probing and unconditionally announce the same name. In that case, two identical .local names exist on the same segment, and it is indeterminate which IP the client will pick. It is a race condition where whoever responds first wins.

It is easier to understand the difference by comparing it to DHCP. DHCP does not have IP address conflicts because a server manages them centrally. On the other hand, mDNS is first-come, first-served based on each device's self-declaration. Although there is a conflict detection mechanism, there is no guarantee that every implementation follows it correctly. As long as it is serverless, this limitation is structural.

The .local domain is officially reserved

Some people might think, ".local is a domain you can use however you want, right?" but it is actually a Special-Use Domain Name officially reserved by the IETF.

The basis for this is RFC 6762 (Multicast DNS, published in February 2013). This RFC stipulates that all fully qualified names ending in .local. are considered "link-local" and must be queried via the mDNS multicast address.

.local cannot be delegated even in ICANN's New gTLD program. It is registered in the IANA Special-Use Domain Names Registry, with RFC 6762 explicitly cited as the supporting document. In other words, .local is a sealed TLD and is never used on the public DNS.

The surprisingly recent "2013"

What many people find surprising here is that RFC 6762 was published in 2013. Many people have the impression that .local has "been around forever," but it was only officially standardized 13 years ago.

The reality is as follows.

  • 2002: Apple introduces "Rendezvous" in Mac OS X 10.2 (Jaguar) and begins using .local for mDNS

  • 2005: Following a trademark lawsuit settlement with TIBCO Software (a conflict with "TIBCO Rendezvous"), Apple renames Rendezvous to "Bonjour" (Mac OS X 10.4 Tiger). In the same year, the first Linux mDNS implementation, Avahi, is released by Lennart Poettering and others (0.1, August 2005)

  • February 2013: Finally officially standardized as RFC 6762. At the same time, RFC 6763, which defines DNS-SD (Service Discovery), is also published

In other words, it is a pattern where the implementation preceded the standardization by over a decade.

Microsoft's .local recommendation — A "dark history"

What is important in this timeline is the presence of Microsoft.

Around 2000, when RFC 6762 did not yet exist, Microsoft recommended .local as an internal domain for Active Directory. Domain names like contoso.local were frequently used in documentation and permeated vendor guidelines.

Microsoft's logic at the time was that "using a TLD not registered in the public DNS ensures that internal and external networks can be reliably separated," and that in itself was not incorrect.

However, Apple and the IETF subsequently took .local for exclusive use by mDNS. As a result, a situation arose where the Active Directory .local domain and the mDNS .local domain directly collided with each other.

Apple warns in an official support article (HT101903) that "because Bonjour uses .local for mDNS, Active Directory domains ending in .local may fail to resolve unicast DNS names or join the domain." Similar issues have been reported on Linux.

In the case of Windows Server 2016 Essentials, an implementation remained where .local was appended as a suffix by default unless the user selected advanced options. What is interesting is the discrepancy that at this point, Microsoft's own official documentation (learn.microsoft.com) had already shifted to deprecating .local even though the installer implementation remained as it was in the past. This was three years after the publication of RFC 6762.

Pitfalls on the client side

The tricky thing about mDNS is that even if the device side announces correctly, name resolution will fail if the client side cannot process .local as mDNS point.

There are two levels of problems here: "differences in implementation" and "presence or absence of implementation."

Behavioral differences by OS — "Differences in implementation"

macOS / iOS Apple's Bonjour is built into the deep layers of the OS. .local is resolved via mDNS without any extra thought. It can be said to be the most stable environment.

Windows A native mDNS responder has been built in since Windows 10 version 1703 (Creators Update, April 2017). Initially, it focused on detecting printers and mirroring devices, and general-purpose hostname resolution was expanded in version 1903 and later. However, in corporate networks using .local as a DNS suffix (a remnant of the Active Directory era), it attempts to query standard DNS instead of mDNS, causing name resolution to fail. Depending on the environment, installing iTunes or Bonjour Print Services can sometimes stabilize it.

Linux Requires installation of avahi-daemon and nss-mdns. Furthermore, it is necessary to add mdns4_minimal to the hosts: line in /etc/nsswitch.conf.

hosts: files mdns4_minimal [NOTFOUND=return] dns

If you get the order of mdns4_minimal and dns wrong here, there are cases where it will try to resolve via DNS before checking mDNS, leading to failure. Since default settings vary by distribution, situations like "it works on Ubuntu but not on CentOS" can occur.

Points to note at the browser level

Regarding .local, Chromium-based browsers like Chrome and Edge are designed to process DNS-SD queries (SRV/TXT/PTR) directly with their built-in mDNS client, while delegating address resolution (A/AAAA) to the OS's name resolution mechanism (getaddrinfo -> nss-mdns -> Avahi on Linux). Therefore, if the OS mDNS settings are correct, the resolution of .local itself is not affected by DoH (DNS-over-HTTPS).

However, if you are using a unicast DNS internal domain (such as corp.example.com) in a corporate network, there are reports that split-horizon DNS (a configuration where the same domain name resolves to different IPs internally and externally) does not function correctly when DoH is enabled. This is a separate issue from mDNS, but it is easily confused because the symptom of "name resolution breaking due to browser settings" is similar.

It should also be noted that Chrome, Edge, and Microsoft Teams may each independently listen on UDP/5353, and even if you disable OS-level mDNS, the browser-side mDNS functionality may not stop.

Embedded devices — "Presence or absence of implementation"

Everything discussed so far has been at the level of "the mDNS stack is present but behaves differently." However, in reality, there are a vast number of devices that lack an mDNS stack entirely.

PLCs (Mitsubishi MELSEC, Omron, TOYOPUC), touch panels (Mitsubishi GOT, Pro-face GP), sensor gateways, and industrial robot controllers—these devices found on FA factory floors do not support mDNS. Whether they are RTOS-based embedded devices or industrial equipment running lightweight Linux (BusyBox-based), they almost always lack the resource overhead to run an Avahi daemon, or it is not included in the build in the first place.

Ideally, it would be convenient to be able to assign .local names to these devices as well. If you could set them up as plc-line1.local or got-main.local, the connection settings for touch panels would become intuitive, and you would no longer need to constantly refer to IP address management tables.

However, in reality, since the majority of devices on control networks do not support mDNS, name resolution via .local only works between "PCs and high-end Linux equipment." The FA (Factory Automation) field remains a world of direct IP address entry or /etc/hosts.

Criteria for on-site judgment: When to trust .local and when not to

Situations where it is safe to trust
  • PCs at home or in the office: File sharing and printer discovery between macOS/Windows/Linux

  • Development and verification environments: Accessing Linux devices where mDNS support is guaranteed, such as Raspberry Pi or GL.iNet routers

  • Small-scale networks on the same segment: Environments with a small number of devices where it has been confirmed that all equipment supports mDNS

Situations where it should not be trusted
  • Control networks (FA/industrial use): Environments where mDNS-incompatible devices such as PLCs and touch panels are mixed in

  • VLAN-segmented networks: mDNS multicast does not cross VLANs by default. While settings like Avahi reflector are required, they become a management cost in themselves

  • Networks with restricted multicast: If multicast is throttled by firewalls or L3 switches, mDNS will not function

  • Systems requiring long-term stable operation: There is a risk that .local resolution may suddenly stop working due to client OS updates or browser updates

Alternative means for the field

In environments where you cannot rely on .local, use the following methods to achieve name resolution.

  • /etc/hosts (or Windows hosts file): The simplest and most reliable method. This is sufficient if the number of devices is small

  • Static DNS records: Manually register A records in routers or DNS servers. Combine this with fixed DHCP assignments

  • DHCP hostname registration: Some routers (such as OpenWrt-based ones) can register hostnames during DHCP leases and resolve them using the router's built-in DNS (e.g., dnsmasq)

While all of these have the disadvantage of "increased management costs," in control networks, "ensuring it works" is the top priority. There are many situations where you should choose the reliability of static settings over the convenience of mDNS.

Supplementary note on multicast traffic

Devices with mDNS enabled periodically send multicast packets. These include hostname announcements, service advertisements (DNS-SD, RFC 6763), and name conflict checks.

This is not an issue in small-scale networks, but in environments with many devices, the increase in multicast traffic is a concern. Especially in FA control networks, it is necessary to confirm whether unnecessary multicast will affect control communications.

In environments where mDNS is not needed, you can address it by stopping daemons like Avahi or by blocking UDP 5353 in the firewall.

Summary

  • .local is resolved using a mechanism called mDNS (Multicast DNS).

  • The protocol is almost identical to DNS, but the query is sent to a multicast address (224.0.0.251:5353) instead of a server.

  • .local is a Special-Use Domain Name officially reserved by the IETF in RFC 6762 (2013).

  • However, implementation began with Apple's Bonjour in 2002, meaning standardization caught up more than 10 years later.

  • Microsoft previously recommended .local for Active Directory, and conflicts still persist today.

  • Differences in client-side implementation (behavioral differences between OSs, browser-specific mDNS implementations, nsswitch.conf settings) often lead to cases where it does not work.

  • Embedded devices and FA equipment do not support mDNS at all, so .local cannot be used in control networks.

  • In environments requiring long-term stable operation, /etc/hosts or static DNS are more reliable.

.local is convenient. But if you trust it too much because "it just works" without understanding the mechanism, you may be caught off guard by OS updates or network configuration changes.

Use it while knowing the constraints behind the convenience. I believe that is the basic attitude for surviving in the field.

Bonus: Chronology of .local and mDNS

  • Around 2000: Microsoft begins recommending .local as an internal domain for Active Directory (KB 296250, etc.).

  • August 2000: The first draft of mDNS (draft-manning-dnsext-mdns-00) is submitted to the IETF.

  • July 2001: Stuart Cheshire submits draft-cheshire-dnsext-multicastdns-00, the prototype for the later RFC 6762.

  • August 2002: Apple introduces Rendezvous in Mac OS X 10.2 (Jaguar). The implementation using .local with mDNS is released to the world.

  • August 2003: TIBCO Software sues Apple for infringement of the "TIBCO Rendezvous" trademark.

  • July 2004: Settlement reached between Apple and TIBCO

  • February 2005: Apple files trademark for "Bonjour"

  • April 2005: Mac OS X 10.4 (Tiger) released. Officially renamed from Rendezvous to Bonjour

  • August 2005: Lennart Poettering and others release Avahi 0.1. Becomes the de facto standard for mDNS/DNS-SD implementation on Linux

  • January 2007: Microsoft's LLMNR (Link-Local Multicast Name Resolution) published as RFC 4795 (Informational). A factor in the conflict with mDNS

  • February 2013: RFC 6762 (Multicast DNS) and RFC 6763 (DNS-SD) published as IETF Standards Track. .local is officially reserved as a Special-Use Domain Name

  • 2016: Windows Server 2016 Essentials still appends the .local suffix by default (though official MS documentation had already shifted to deprecating it)

  • April 2017: Native mDNS responder incorporated in Windows 10 version 1703 (Creators Update)

From the start of implementation (2002) to standardization (2013) was about 10 and a half years. During that time, various events occurred in parallel, including Microsoft's .local recommendation, the Apple trademark lawsuit, and the emergence of Linux implementations.

Bonus extra: An alternative solution called aterm.me

By the way, .local (mDNS) is not the only way to access a router by hostname. With NEC's Aterm series, entering http://aterm.me into a browser opens the settings screen.

This is a completely different approach from .local.

Mechanism

.me is the country-code top-level domain (ccTLD) for Montenegro, and it is not a special domain reserved by the IETF, but rather a TLD that is normally registered and traded on the public DNS. It is the same framework that LINE used for line.me.

In other words, NEC (NEC Platforms) has actually acquired the domain aterm.me. The Aterm router's built-in DNS proxy then intercepts queries for aterm.me and resolves them to its own LAN-side IP address (e.g., 192.168.10.1).

From the client's perspective, a normal DNS query goes to the router, and the router simply responds, "That's me." No mDNS stack or multicast is required at all.

In fact, aterm.me also has an A record registered on public DNS (hosted on AWS Route 53 and pointing to a server in the Tokyo region). However, devices within the LAN never see this value. This is because the client's DNS server is set to the Aterm itself (192.168.10.1), so the built-in DNS intercepts the request and returns its own IP before it can be forwarded to the upstream public DNS.

The A record on the public DNS is likely intended as a fallback in case a user accidentally accesses aterm.me from outside the LAN. It is designed to guide them to a support page or information screen rather than returning an NXDOMAIN.

Conversely, if you manually change the client's DNS settings to 8.8.8.8 or similar, it will no longer go through the Aterm's built-in DNS, making it impossible to access the management screen via aterm.me. "The DNS must point to the router" is a prerequisite, and this point is easy to overlook.

Comparison with .local

To summarize the differences between the two, first, the nature of the domain is fundamentally different. .local is a Special-Use Domain Name reserved by the IETF exclusively for mDNS, whereas the .me in aterm.me is Montenegro's ccTLD, a regular domain that NEC acquired on public DNS.

The mechanism for name resolution is also different. .local queries devices within the same segment via multicast (224.0.0.251:5353), while aterm.me uses the router's built-in DNS proxy to intercept standard DNS queries.

As for client-side requirements, .local requires an mDNS stack (Bonjour, Avahi, etc.), whereas aterm.me requires no special implementation as long as the DNS points to the router.

Operating conditions are that .local must be within the same segment, while aterm.me requires router mode and DNS routing through the router.

Compatibility with other vendors' equipment is that .local can be used on any device with Avahi or similar, while aterm.me is exclusive to NEC Aterm.

NEC's approach is solid in that it is completed solely through standard DNS mechanisms. It is not affected by differences in client-side implementation. On the other hand, since the built-in DNS proxy only functions in router mode, there is a limitation where you cannot access it via aterm.me in bridge mode.

Differences in design philosophy

mDNS is an open design where "it is serverless and anyone can announce their own name." aterm.me is a closed design where "the company acquires its own domain and completes the process within its own equipment."

It is not a matter of which is superior, but rather that the premises and constraints are different. mDNS is versatile but client-dependent; aterm.me is vendor-specific but works reliably.

When you think "I want to access by hostname" in the field, knowing which mechanism is running behind the scenes will speed up troubleshooting. When you cannot connect via .local, is it an mDNS issue, a DNS issue, or perhaps a completely different mechanism? I hope this article helps in making that judgment.

Reference links (primary sources)

RFC/Standard Specifications

  • RFC 6762 - Multicast DNS (IETF, February 2013) - Main mDNS specification. Probing (Section 8.1), Conflict Resolution (Section 9), TTL=255 (Section 11)

  • RFC 6763 - DNS-Based Service Discovery (IETF, February 2013) - DNS-SD. Service discovery via PTR/SRV records

  • IANA Special-Use Domain Names Registry (IANA) - Reservation registration for .local

Apple-related

  • Apple Introduces "Jaguar" (Press Release, July 2002) - Announcement of the first Rendezvous implementation

  • Apple Support HT101903 - Apple devices might not open your internal network's '.local' domain - Official warning regarding .local Active Directory conflicts

  • Bonjour (software) - Wikipedia - Background on the renaming from Rendezvous to Bonjour (2005, TIBCO trademark settlement)

Microsoft-related

  • mDNS in the Enterprise (Microsoft Tech Community, April 2022) - Primary source for native mDNS support in Windows 10 version 1703 and later

  • Naming conventions for computer domain, site, and OU (Microsoft Learn) - Policy shift toward deprecating .local

Linux-related

  • avahi/nss-mdns (GitHub) - Official reference for nsswitch.conf configuration. Distinguishing between mdns4_minimal and mdns4

Browser-related

  • Chromium DNS over HTTPS - DoH auto-upgrade design policy (design that does not change the resolution target)

同じカテゴリの記事

藤崎 健人

芸能取材歴10年のデスク。所属事務所の公式リリース、番組公式サイト、配信サービスの告知を一次情報として採用し、裏付けの取れない内容は記事にしていません。

おすすめの関連記事