DNS vs mDNS protocol in networking
DNS (Domain Name System) and mDNS (Multicast DNS) are both protocols used for resolving domain names to IP addresses, but 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 Full form | Domain Name System
As mentioned DNS is the short form of Domain Name System. It uses DNS servers. The DNS server maps host name to the IP address similar to phone books or directory which maps name to phone number. This is done as it is easy to remember the name compare to ip address.
Prior to development of DNS, hosts file need to be managed which contains ip addresses and their respective names. But over the time, due to large number of computers have been added to the internet, it has become difficult to manage updated copy of the hosts file in all the computers. This has lead to the development of DNS across the world.

DNS works by exchanging messages between client and server machines. A client application will pass the destination host name to the DNS process in order to obtain IP address.
As shown in the figure-1, hardware addresses are used in physical network, IP addresses are used in internet and symbolic addresses such as domain names are used in the applications or used by users. ARP/RARP protocols convert IP address to MAC address and viceversa. DNS does translation between domain name and IP address.
DNS is a distributed database implemented in a hierarchy of name servers. The figure depicts DNS and mDNS hierarchy and syntax in tree form. As shown, the domain name is divided into TLD (top level domain), label and host name. Each organization needs to obtain TLD (e.g. com, org, edu etc.) from central authority. Also refer DNS vs DHCP >> for understading difference between DNS and DHCP protocols.
mDNS | Multicast DNS
Like DNS, mDNS also resolves domain names to IP addresses. mDNS operate at local network level unlike conventional DNS which operates at global level. It works in conjunction with DNS-SD (service discovery) protocol in zeroconf network. Zero configuration network does not require manual operation. Moreover zeroconf network does not rely on DNS server and DHCP server for its operation.

DNS-SD allows clients to discover named list of service instances and its service type and resolves these various services to hostnames using standard DNS query message. The mDNS protocol is specified in RFC 6762 and DNS-SD protocol is specified in RFC 6763. There are various implementations of mDNS which include Bonjor, Avahi, Windows etc. The figure depicts tree of conventional DNS and multicast DNS (i.e. mDNS) naming structure.
Multicast DNS works at link local level and hence every node can be reached without routing. mDNS packet will not be forwarded by any router.
For link-local scope, IETF defines one single top level domain ".local.". THis is reserved for link local name used in mDNS network. It allows any device to generate its link local domain name in the forms such as "single-dns-label.local.". For example "Mycomputer.local.".
Moreover it is also possible to use hierarchical name by users themselves such as "c.printing.local." or "d.printing.local." etc. The domain ".local." is treated the same as any other domain which might appear in 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.

Let us understand mDNS with example as shown in the figure. As shown, let us assume that there are three nodes and node-1 would like to utilize printing service offered by node-2. As mentioned all the nodes in mDNS system functions as server or client. This is flat structure followed by mDNS protocol.
➨Let us assume that node-1 needs IP address of node-2.
➨As there is no centralized DNS server in the small network made of mDNS, node-1 does not
know from where to get IP address of node-2.
➨In this scenario, node-1 sends multicast query asking for IP address of 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 to respond or not.
➨Since node-2 has authority for this query, it generates response to answer this question of the query. Here node-2
acts as 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 printing service served by node-2.
➨There were two approaches for node-1 to know node-2 offers 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 DNS-SD protocol to discover services offered by node-2.
Tabular difference between DNS and mDNS protocol
Following table compares DNS vs mDNS and provide differences between both of these protocols. This comparison between traditional or conventional DNS with mDNS is very useful for beginners.
Features | Conventional DNS | mDNS |
---|---|---|
Full Form | Domain Name System | Multicast Domain Name System |
Structure type and size | Hierarchical structure, max. size : 255 bytes for each domain | Flat structure, Max. size : 255 bytes |
IP address | Global IP adress | Link-Local / Global IP address |
Name server record | Yes | No |
Start of Authority Record | Yes | No |
Source / Destination UDP port | 53 | 5353 |
UDP packet size | 512 bytes | > than 512 bytes |
Number of questions in a Query message | 1 | 1 or more |
Known answer suppression | No | Yes |
Query ID field | Use | Ignore |
Question section in response message | Exist | Does not exist |
Server | Specialized DNS server is required | Each node functions as server |
Send method | Unicast | Multicast/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 advantages and disadvantages of mDNS protocol >> over traditional or conventional DNS protocol.