← Back to list

How to Enable and Use mDNS on Any System

Step-by-step guide to configuring and using mDNS across platforms. Discover devices, test connections, and manage hostnames easily

Haridasmahato · 2025-09-14 13:16 · 3 claps · 2.5 min read
#mdn #networking #avahi #bonjour #life-hack-tricks
Open on Medium ↗

How to Enable and Use mDNS on Any System

Ever wondered how your smart TV, laptop, or smartphone can discover each other on the same network without typing IP addresses? The secret sauce is mDNS — Multicast Domain Name Service. Whether you’re a developer, IT enthusiast, or just a curious tinkerer, understanding mDNS can make your network life a lot smoother — it has done mine btw. For detail explanation RFC1034 (btw RFC stands for Request For Commnets), avahi.

What is mDNS and Why You Should Car

mDNS (Multicast DNS) is a protocol that allows devices on the same local network to discover each other without a central DNS server. Think of it as a “neighborhood shout-out”: your device asks, “Hey, who’s on the network?” and everyone responds with their name and IP address.

You should care because:

  • It enables zero-configuration networking (also called Zeroconf).
  • Devices like printers, smart lights, and NAS drives rely on it.
  • It powers services like Apple’s AirPlay, Google Cast, and file sharing.
  • And most of all its a cool hack

Without mDNS, you’d have to manually type IP addresses to connect devices — a headache on dynamic networks — believe me when i say this.

How mDNS Works

mDNS works over UDP port 5353 and uses IPv4 multicast address 224.0.0.251 and the IPv6 multicast address ff02::fb. Here’s the gist (for extreme detail look here):

  1. A device broadcasts a query asking for a hostname.
  2. The device with that hostname responds with its IP address.
  3. Other devices cache the response for faster future lookups.

Example: Your laptop tries to connect to printer.local (and yes, the .local is almost always required—skip it once and you’ll just end up retyping the command). It sends out a multicast query. The printer replies with 192.168.1.42— btw you don’t have to care about the ip and port mDNS resolves internally. Done—connection established. No router, no central DNS, no drama.Avahi vs. Bonjour

Two major players implement mDNS:

  • Avahi — Popular on Linux, open-source.
  • Bonjour — Apple’s implementation, built into macOS and iOS, available for Windows.

Both provide the same core functionality, but installation and configuration differ slightly depending on the OS.

Setting Up mDNS

Linux (Using Avahi)

# Install Avahi:
sudo apt update
sudo apt install avahi-daemon avahi-utils

# Start and enable the service:
sudo systemctl start avahi-daemon
sudo systemctl enable avahi-daemon

# Test:
avahi-browse -a                    # browse all
avahi-resolve -n <hostname>.local  # get <hostnames's> ip
ping <hostname>.local              # test if <hostname> is responding

Windows (Using Bonjour)

  1. Download Bonjour Print Services from Apple.
  2. Install and allow firewall access.
  3. Test via ping <hostname>.local in Command Prompt.

macOS (Bonjour built-in)

  • In mac bonjour comes pre-installed.
# Check connected devices:
dns-sd -B _services._dns-sd._udp

# Ping another .local device:
ping printer.local

Android

  • Apps like Service Browser or Network Browser allow mDNS discovery.
  • Some Android apps use mDNS internally to find smart devices on your network.
  • but if you feel hacky you can download termux (terminal in android)

Testing mDNS

  1. Use ping <hostname>.local from any device.
  2. On Linux: avahi-browse -a
  3. On macOS: dns-sd -B _services._dns-sd._udp
  4. On Windows: ping <hostname>.local

If devices respond, mDNS is working.

Changing Your Hostname

Linux:

sudo hostnamectl set-hostname newname

macOS:

sudo scutil - set HostName newname

Windows:

Settings → System → About → Rename this PC

If hostname didn’t change, restart the network service (systemctl restart avahi-daemon — for linux) or reboot. Your .local address now matches the new name.

TL;DR

mDNS is like a friendly neighborhood directory for devices on the same network. With Avahi, Bonjour, or compatible tools, you can:

  • Instantly discover devices.
  • Avoid typing IP addresses.
  • Make your network smarter, not harder.

Whether on Linux, Windows, macOS, or Android, mDNS lets devices whisper sweet .local addresses to each other — so you can spend less time typing and more time streaming, printing, or syncing.


메타데이터
post_id
c87fede76de9
slug
how-to-enable-and-use-mdns-on-any-system-c87fede76de9
url
https://medium.com/@haridasmahato12/how-to-enable-and-use-mdns-on-any-system-c87fede76de9
canonical_url
https://medium.com/@haridasmahato12/how-to-enable-and-use-mdns-on-any-system-c87fede76de9
author_url
https://medium.com/@haridasmahato12
status
ok
fetched_at
2026-08-12 22:48:32