MQUERY(1)

NAME
mquery - small query tool for multicast DNS

SYNOPSIS
mquery [-hDsTv] [-6] [-i IFACE] [-d HOST] [-l LEVEL] [-t TYPE] [-w SEC] [NAME]

DESCRIPTION
mquery is a companion tool to mdnsd(8), but can also be used stand-alone with other mDNS responders. It sends mDNS queries and prints the replies, much like mdns-scan(1), but it also resolves what it finds. With -D it follows each service PTR to its SRV, TXT, and address records and prints a device table, and with -T or -w it stops on its own instead of running until interrupted.

By default mquery browses all service types on the link. Give a service type, such as _http._tcp, to list its instances, or a host or instance name together with -t to resolve a specific record. The .local. domain is appended automatically unless the name is already rooted with a trailing dot.

mquery runs on the system default interface, derived from the routing table; use -i IFACE to run on another.

OPTIONS
This program follows the usual UNIX command line syntax. The options are as follows:

-6  Query over IPv6 (the ff02::fb group) instead of IPv4.

-h  Print a bare bones help message and exits.

-D  Scan all services and present a deduplicated device table with name, address, and product columns. Use with -T to exit automatically, or with -w SEC to set a fixed collection window.

-T  Terminate automatically after the network has been quiet for two seconds. Intended for use with -D or -d, analogous to avahi-browse(1)'s -t option.

-d HOST
    Like -D, but filter results to HOST and show a detailed per-service breakdown instead of the summary table. HOST may be given with or without the .local. suffix.

-i IFACE
    Interface to run query on, by default the system default interface is used, derived from the routing table.

    Only available on Linux.

-l LEVEL
    Set the log level: none, err, notice (default), info, or debug.

-s  Simple output: print one line per record as it arrives, instead of the default browse that follows service PTR records. Implied whenever -t requests a type other than PTR.

-t TYPE
    Query for the given record TYPE, a numeric DNS type, default 12 (PTR). For any type other than PTR the replies are printed directly, as if -s were given. The common types are:

    A (1)
        IPv4 address
    NS (2)
        name server
    CNAME (5)
        alias (canonical name)
    PTR (12)
        service instance or pointer
    TXT (16)
        service metadata
    AAAA (28)
        IPv6 address
    SRV (33)
        service target host and port
    ANY (255)
        any of the above

-v  Show program version, along with the project homepage and the address for bug reports.

-w SEC
    Delay (approximate) in seconds before automatically exiting.

EXAMPLES
Browse all service types on the link:

    mquery

List the SSH servers, then resolve one to its host and port:

    mquery _ssh._tcp
    mquery -t 33 myhost._ssh._tcp

Look up a host's address, or a service's TXT metadata:

    mquery -t 1 myhost
    mquery -t 16 myhost._ssh._tcp

Scan the link and resolve it into a device table:

    mquery -D

Show one device in detail, or let the scan stop itself for scripting:

    mquery -d myhost
    mquery -D -T

Query over IPv6 instead of IPv4:

    mquery -6 _http._tcp

The .local. domain is implied in all of these, and -D and -d print their table on Ctrl-C or, for scripts, with -T or -w SEC.

SEE ALSO
avahi-browse(1), mdns-scan(1), mdnsd(8)

AUTHORS
This mDNS-SD implementation was created in 2003 by Jeremie Miller <jer@jabber.org>. Much later, in 2016, it was adopted by Joachim Wiberg <troglobit@gmail.com> for further development and maintenance at GitHub: <https://github.com/troglobit/mdnsd>.