DNS vs. mDNS: Key Differences in Networking Protocols

dns
mdns
networking protocol
domain name
hostname resolution

DNS (Domain Name System) and mDNS (Multicast DNS) are both protocols used for resolving domain names to IP addresses. However, they serve different purposes and operate in distinct ways.

DNS is secure and scalable for internet-wide use, while mDNS is lightweight and suitable for small-scale networks like home or local ad-hoc setups, where simplicity and decentralization are prioritized over extensive security measures.

DNS: Domain Name System

As mentioned, DNS is the short form of Domain Name System. It uses DNS servers. The DNS server maps hostnames to IP addresses, similar to how phone books or directories map names to phone numbers. This is done because it’s easier to remember names compared to IP addresses.

Prior to the development of DNS, host files needed to be managed, containing IP addresses and their respective names. But over time, due to the large number of computers added to the internet, it became difficult to manage an updated copy of the host file on all computers. This led to the development of DNS across the world.

DNS servers and resolvers

DNS works by exchanging messages between client and server machines. A client application will pass the destination hostname to the DNS process in order to obtain its IP address.

As shown in Figure 1, hardware addresses are used in physical networks, IP addresses are used on the internet, and symbolic addresses such as domain names are used in applications or by users. ARP/RARP protocols convert IP addresses to MAC addresses and vice versa. DNS does the translation between domain names and IP addresses.

DNS is a distributed database implemented in a hierarchy of name servers. The domain name is divided into TLD (top-level domain), label, and hostname. Each organization needs to obtain a TLD (e.g., .com, .org, .edu, etc.) from a central authority.

Also, refer to DNS vs. DHCP for understanding the difference between DNS and DHCP protocols.

mDNS: Multicast DNS

Like DNS, mDNS also resolves domain names to IP addresses. However, mDNS operates at the local network level, unlike conventional DNS, which operates at a global level. It works in conjunction with the DNS-SD (service discovery) protocol in a zeroconf network.

Zero-configuration networks don’t require manual configuration. Moreover, zeroconf networks don’t rely on DNS servers and DHCP servers for their operation.

mDNS Name Structure

DNS-SD allows clients to discover named lists of service instances and their service types, and resolves these various services to hostnames using standard DNS query messages.

The mDNS protocol is specified in RFC 6762, and the DNS-SD protocol is specified in RFC 6763. There are various implementations of mDNS, including Bonjour, Avahi, Windows, etc.

Multicast DNS works at the link-local level, and hence every node can be reached without routing. mDNS packets will not be forwarded by any router. For link-local scope, the IETF defines one single top-level domain: “.local.”. This is reserved for link-local names used in mDNS networks. It allows any device to generate its link-local domain name in forms such as “single-dns-label.local.”, for example, “Mycomputer.local.”. Moreover, it’s also possible to use hierarchical names by users themselves, such as “c.printing.local.” or “d.printing.local.”, etc.

The domain “.local.” is treated the same as any other domain that might appear in a DNS search list but has only local significance. If the domain name ends with “.local.”, it means this message should be processed by the mDNS protocol.

mDNS working example

Let’s understand mDNS with an example as shown in the figure. Assume that there are three nodes, and node-1 would like to utilize a printing service offered by node-2. As mentioned, all the nodes in an mDNS system function as servers or clients. This is the flat structure followed by the mDNS protocol.

  • Let’s assume that node-1 needs the IP address of node-2.
  • As there is no centralized DNS server in the small network made of mDNS, node-1 doesn’t know from where to get the IP address of node-2.
  • In this scenario, node-1 sends a multicast query asking for the IP address of the domain name “node2.local” to all the nodes connected in this local network.
  • Consequently, both node-2 and node-3 in the local network receive the query and decide whether to respond or not.
  • Since node-2 has authority for this query, it generates a response to answer the question of the query. Here, node-2 acts as a server for the requested query. The response from node-2 is multicasted to the local network.
  • Node-1 receives the multicast message and will utilize it for the printing service served by node-2.
  • There are two approaches for node-1 to know whether node-2 offers the printing service or not. In the first approach, node-1 caches periodical service announcements transmitted by node-2. In the second approach, node-1 may use the DNS-SD protocol to discover services offered by node-2.

Tabular Difference Between DNS and mDNS Protocol

The following table compares DNS vs. mDNS and provides the differences between both of these protocols. This comparison between traditional or conventional DNS with mDNS is very useful for beginners.

FeaturesConventional DNSmDNS
Full FormDomain Name SystemMulticast Domain Name System
Structure type and sizeHierarchical structure, max. size: 255 bytesFlat structure, Max. size: 255 bytes
IP addressGlobal IP addressLink-Local / Global IP address
Name server recordYesNo
Start of Authority RecordYesNo
Source / Destination UDP port535353
UDP packet size512 bytes> than 512 bytes
Number of questions in a Query message11 or more
Known answer suppressionNoYes
Query ID fieldUseIgnore
Question section in response messageExistDoes not exist
ServerSpecialized DNS server is requiredEach node functions as server
Send methodUnicastMulticast/Unicast

Conclusion

In summary, DNS (Domain Name System) and mDNS (Multicast DNS) serve divergent purposes in the realm of network communication.

DNS is a global, hierarchical system tailored for large-scale networks, offering secure and centralized domain name resolution on the internet. In contrast, mDNS is a lightweight protocol designed for local networks, utilizing multicast communication to enable decentralized and autonomous hostname resolution among devices in smaller environments.

While DNS excels in providing security and scalability for internet-wide applications, mDNS prioritizes simplicity and decentralization, making it suitable for scenarios like home networks or local ad-hoc setups where a centralized DNS infrastructure is impractical.

Refer to the advantages and disadvantages of the mDNS protocol over the traditional or conventional DNS protocol.

mDNS Protocol: Advantages and Disadvantages

mDNS Protocol: Advantages and Disadvantages

Explore the benefits and limitations of the mDNS protocol, a local network substitute for traditional DNS, including its advantages and disadvantages.

mdns
protocol
networking
DNS vs. DHCP: Key Differences Explained

DNS vs. DHCP: Key Differences Explained

Explore the differences between DNS (Domain Name System) and DHCP (Dynamic Host Configuration Protocol), including their functions and protocols, in this concise guide.

dns
dhcp
networking basics

SLIP vs PPP: Comparing Dial-Up Internet Protocols

Explore the differences between SLIP and PPP, two protocols used for dial-up internet. Learn about SLIP's limitations and how PPP addresses them, making it the dominant protocol today.

networking protocol
point-to-point protocol
serial line