mdnsMulticast DNS Zero-Configuration DiscoveryWho Brought a Smart TV Onto the Corp VLAN? (mdns UDP 5353)
What It Does on the Wire
Chatty printers, Apple TVs, and rogue IoT gadgets shouting .local records on 224.0.0.251:5353 — mdns locks both source and destination ports to 5353 per RFC 6762.
Multicast DNS (mdns, RFC 6762) enables zero-configuration .local hostname resolution and DNS-SD service discovery (Apple Bonjour, Linux Avahi, Chromecast, AirPrint, Matter IoT) without a central DNS server. Every frame runs on UDP 5353 -> 5353.
When compiling mdns, FrameAssembly automatically rewrites the wire destination IP and Ethernet multicast MAC to 224.0.0.251 (01:00:5e:00:00:fb) on IPv4 or ff02::fb (33:33:00:00:00:fb) on IPv6, sets txid 0 per RFC 6762 §18.1, and shares full RFC 1035 label validation with dns.
Campus Wireless Bonjour / AirPrint Gateway & VLAN Reflector Testing
Test Cisco/Aruba mDNS gateway service-routing policies across guest and corporate VLANs (vlan 20, _ipp._tcp.local, _airplay._tcp.local).
Lateral Movement & LLMNR/mDNS Poisoning Detection Labs
Model unsolicited mdns response frames claiming .local hostnames to verify SOC/EDR multicast poisoning alerts.
Matter & Smart-Building IoT Discovery Audits
Emit IPv6 ff02::fb _matter._tcp.local PTR and AAAA discovery exchanges for embedded IoT test harnesses.
Minimal Quickstart (mdns_quickstart.frasm)
Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.
host laptop { ip 192.168.10.42 }host printer { ip 192.168.10.90 }compile { laptop -> printer mdns query qname "_ipp._tcp.local" qtype "PTR" wait 3ms printer -> laptop mdns response qname "laserjet-3f.local" qtype "A" rdata "192.168.10.90" ansttl 120}What the Compiler Calculates So You Don't Have To
- Overrides the L3 destination IP to link-local multicast
224.0.0.251(IPv4) orff02::fb(IPv6) with matching multicast Ethernet MAC (01:00:5e:00:00:fb/33:33:00:00:00:fb). - Fixes both UDP source and destination ports to
5353 -> 5353and defaultstxidto0per RFC 6762. - Enforces RFC 1035 label (
<= 63B) and total name (<= 253B) validation identically todns.
Dual-Stack DNS-SD Service Browse (PTR) and Host Address Announcement (AAAA)
Discovers _matterc._udp.local commissioning nodes and announces an IPv6 link-local service record over VLAN 30.
host controller { ip fe80::10 mac 00:1c:73:aa:00:10 }host sensor_hub { ip fe80::55 mac 00:1c:73:aa:00:55 }compile { // 1. Multicast browse query to ff02::fb on UDP 5353 -> 5353 controller -> sensor_hub mdns query qname "_matter._tcp.local" qtype "PTR" vlan 30 ttl 255 wait 2ms // 2. Hub announces PTR instance and AAAA address record sensor_hub -> controller mdns response qname "_matter._tcp.local" qtype "PTR" rdata "hub-01._matter._tcp.local" ansttl 4500 vlan 30 ttl 255 wait 1ms sensor_hub -> controller mdns response qname "hub-01.local" qtype "AAAA" rdata "fe80::55" ansttl 120 vlan 30 ttl 255}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show mdns_ipv6_matter_discovery.frasm
# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly mdns_ipv6_matter_discovery.frasm mdns_ipv6_matter_discovery.pcap
frameassembly mdns_ipv6_matter_discovery.frasm mdns_ipv6_matter_discovery.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse mdns_ipv6_matter_discovery.pcap mdns_ipv6_matter_discovery_edited.frasmAll mdns Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after mdns:
src_host -> dst_host mdns [query | response] [txid <0..65535>] [qname "<text>"] [qtype "<text>"] [rdata "<text>"] [rcode <0..15>] [ansttl <number>]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| query | response | mDNS message direction keyword | query | Selects mDNS Question (0x0000) or Authoritative Multicast Response (0x8400). |
| qname "<text>" | .local domain or service string | "_http._tcp.local" | Encodes the Question/Answer domain labels (<= 63B per label, <= 253B total). |
| qtype "<text>" | "PTR" | "SRV" | "TXT" | "A" | "AAAA" | "ANY" | "PTR" | Sets the 16-bit DNS record type. |
| rdata "<text>" | ansttl <number> | Record data string, u32 seconds | ansttl 120 | Encodes the Answer RR payload and cache lifetime on mdns response frames. |
| txid <0..65535> | rcode <0..15> | 16-bit ID, 4-bit RCODE | txid 0, rcode 0 | Overrides Transaction ID (legacy unicast queries) or response code. |
Cross-Layer Wrappers Valid with mdns
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
10 options
Cross-Layer Wrappers Valid with mdns
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | Colon, hyphen, or Cisco dot MAC | Host MAC / RFC multicast MAC | Overrides the 14-byte Ethernet II source or destination MAC address for this single packet. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255 | Unlabeled (at most 1 mpls tag per packet) | Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] | IPv4 ID, DF/MF flags, fragment offset 0..8191 | ipid 1, flags 0, fragoffset 0 | Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts). |
| srcport <0..65535> | dstport <0..65535> | Port number 0..65535 | srcport 49152 (remembered), UDP 5353 -> 5353 (224.0.0.251 / ff02::fb) | Overrides source or destination port and remembers the port pair automatically on <- replies. |
Gotchas & Quick Fixes
mDNS Is Strictly UDP-Only (transport tcp Is Rejected)
laptop -> printer mdns query qname "_http._tcp.local" transport tcplaptop -> printer mdns query qname "_http._tcp.local"RFC 6762 Multicast DNS operates exclusively over UDP 5353; mdns is not on the 9-protocol transport whitelist.
Use ansttl for Resource Record TTL vs ttl for IP Hop Limit
printer -> laptop mdns response rdata "192.168.10.90" ans_ttl 120printer -> laptop mdns response rdata "192.168.10.90" ansttl 120 ttl 255ansttl 120 sets the mDNS resource record cache lifetime, while ttl 255 sets the IPv4/IPv6 Hop Limit.