Multicast DNS

Also known as: mDNS

On this page 7

Multicast DNS (mDNS) is a protocol that performs DNS-style name resolution on a local link by sending queries to a multicast address instead of a configured server. Specified in RFC 6762, it lets devices answer for their own names in the reserved .local domain, so printers, speakers and laptops can find each other without any administrator, zone file or DNS resolver.

Within DNS as a whole, mDNS reuses the standard DNS message format and record types, but replaces the hierarchical, server-based lookup with a cooperative, peer-to-peer model limited to one network segment. It is the naming layer beneath zero-configuration networking, most often paired with DNS-based service discovery.

Multicast DNS resolves a name by multicasting the question to every host on the link and letting the owner of that name reply. A client that wants the address of printer.local sends a query to 224.0.0.251 for IPv4 or ff02::fb for IPv6, always on UDP port 5353. Every mDNS responder receives the packet, and only the device that holds the name answers.

Responses are normally multicast back to the whole group, which allows other hosts to fill their caches passively and avoid repeating the same question. A querier can set the unicast-response bit when it only needs a direct reply, for example right after joining the network. Because packets use a link-local scope, routers do not forward them, which keeps traffic confined to one broadcast domain.

The following table lists the core protocol constants that every implementation shares.

ParameterValuePurpose
IPv4 multicast group224.0.0.251Destination for IPv4 queries and replies
IPv6 multicast groupff02::fbDestination for IPv6 queries and replies
UDP port5353Separates mDNS from unicast DNS on port 53
Reserved domain.localNames resolved only by multicast
IP TTL of packets255Lets receivers reject off-link packets
Typical record TTL120 s or 4,500 sShort for host records, long for other records
Core mDNS protocol parameters

Probing, announcing and conflict resolution

Before a device uses a name, it must prove that no other host already owns it, because mDNS has no central authority to assign names. This happens in a strict start-up sequence defined by the specification, and it is the main reason mDNS works without configuration yet still produces unique names on the link.

  1. Probing: the host sends three queries for its intended name about 250 ms apart and listens for any answer.
  2. Tie-breaking: if two hosts probe the same name at once, a lexicographic comparison of their proposed records decides the winner.
  3. Renaming: the losing host picks a new name, commonly by appending a number such as printer-2.local.
  4. Announcing: the winner multicasts unsolicited responses with the cache-flush bit set so peers replace stale data.
  5. Goodbye: on clean shutdown the host sends its records with a TTL of zero so caches drop them immediately.

Ongoing efficiency depends on known-answer suppression: a querier lists the answers it already holds, and responders stay silent when those answers are still fresh. Combined with randomized delays of 20-120 ms before replying to shared records, this keeps multicast traffic modest even on links with dozens of devices.

Multicast DNS compared with unicast DNS

Multicast DNS and conventional unicast DNS share message syntax and record types but differ in almost every operational respect. The comparison below shows why mDNS suits small, unmanaged networks while ordinary DNS remains the backbone of internet naming.

AspectUnicast DNSMulticast DNS
Who answersAuthoritative and recursive serversThe device that owns the name
NamespaceGlobal hierarchy under the rootFlat names under .local
ScopeEntire internetOne link or broadcast domain
ConfigurationZone files, delegation, registrarNone required
TransportUDP and TCP port 53, DoH, DoTUDP port 5353 multicast
UniquenessGuaranteed by delegationAchieved by probing
Security optionsDNSSEC, encrypted transportsEssentially none in practice
Unicast DNS versus multicast DNS

Related link-local protocols exist as well. LLMNR, defined by Microsoft for Windows, solves a similar problem on port 5355 but has been deprecated in favor of mDNS in recent Windows releases. NetBIOS name service is older still and relies on broadcast rather than multicast.

Service discovery and typical deployments

In practice, multicast DNS is rarely used alone; it is the transport for DNS-based service discovery (DNS-SD), specified in RFC 6763. DNS-SD uses PTR, SRV and TXT records to advertise what a device offers, so a client can browse for every printer or media receiver instead of knowing a host name in advance.

The next table shows how the three record types work together when a client browses for a service.

RecordExample owner nameWhat it provides
PTR_ipp._tcp.localList of service instances of one type
SRVOffice Printer._ipp._tcp.localTarget host name and port
TXTOffice Printer._ipp._tcp.localKey-value metadata such as model or paper size
A or AAAAoffice-printer.localIPv4 or IPv6 address of the host
Records used in DNS-based service discovery

Major implementations include Apple Bonjour, the open-source Avahi daemon on Linux and the native mDNS stack in Windows and Android. Typical consumers are network printing, screen casting, smart-home hubs, music streaming between rooms and developer tools that publish a test server to colleagues on the same network.

Limitations, security risks and common problems

The convenience of mDNS comes from trusting every host on the link, and that trust is also its main weakness. Any device can answer for any name, so an attacker on the same segment can spoof responses and redirect traffic. Announcements also leak device names and services, which matters on guest and public Wi-Fi.

Operational problems usually stem from the link-local boundary or from misconfigured equipment. The table below maps frequent symptoms to causes and fixes.

SymptomLikely causeRemedy
Devices invisible across VLANsMulticast does not cross routersUse an mDNS reflector or gateway
Discovery fails on Wi-Fi onlyClient isolation or multicast filteringAdjust access point multicast settings
Name keeps changing to name-2Duplicate host or a sleep proxy conflictRemove the duplicate or rename manually
Corporate .local names breakInternal unicast zone uses .localMove the internal zone to another suffix
Excess multicast trafficMany chatty devices on one segmentSegment the network and filter by service
Common mDNS symptoms and remedies

A frequent design mistake is using .local for an internal unicast DNS zone. Clients then route those lookups to mDNS, producing slow or failed resolution. The safer choice is a dedicated internal suffix such as home.arpa for residential networks or a subdomain of a registered domain.

The idea in brief

Normally a computer finds another computer by asking a directory service, much like calling an operator for a phone number. Multicast DNS removes the operator. A device simply asks the whole room, “Who is office-printer?”, and the printer itself answers with its address.

Because everyone hears the answer, other devices remember it too. The approach only works inside one local network, and it assumes the people in the room are honest. The key point is that mDNS lets devices name and find each other with no setup at all.

A practical scenario

A small architecture office with twelve employees buys a network printer and a wireless display for its meeting room. No one on staff manages a DNS server. When the printer powers on, it probes for office-printer.local, finds the name free and announces it, along with an IPP print service record. Laptops running macOS and Windows see the printer in their print dialogs within seconds.

Later, the office splits its network into a staff VLAN and a guest VLAN, and the printer disappears from staff laptops because it sits on the other segment. The contractor enables an mDNS gateway on the router that forwards only printer and display services between the two VLANs. Discovery works again without exposing every device to guests, and no one has to type an IP address.