return a list of domains recommended for registering(advertising) services.
return a list of domains recommended for browsing services.
Normally, on your home network, the only domain you are likely to see is "local". However if your network administrator has created Domain Enumeration records, then you may also see other recommended domains for registering and browsing.
|-R name type domain port [key=value ...]|
register (advertise) a service in the specified
with the given
as listening (on the current machine) on
name can be arbitrary unicode text, containing any legal unicode characters (including dots, spaces, slashes, colons, etc. without restriction), up to 63 UTF-8 bytes long. type must be of the form "_app-proto._tcp" or "_app-proto._udp", where "app-proto" is an application protocol name registered at http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml.
domain is the domain in which to register the service. In current implementations, only the local multicast domain "local" is supported. In the future, registering will be supported in any arbitrary domain that has a working DNS Update server [RFC 2136]. The domain "." is a synonym for "pick a sensible default" which today means "local".
port is a number from 0 to 65535, and is the TCP or UDP port number upon which the service is listening.
Additional attributes of the service may optionally be described by key/value pairs, which are stored in the advertised services DNS TXT record. Allowable keys and values are listed with the service registration at http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml.
|-B type domain|
browse for instances of service
For valid type s see http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml. as described above. Omitting the domain or using "." means "pick a sensible default."
|-L name type domain|
look up and display the information necessary to contact and use the
named service: the hostname of the machine where that service is
available, the port number on which the service is listening, and (if
present) TXT record attributes describing properties of the service.
Note that in a typical application, browsing may only happen rarely, while lookup (or "resolving") happens every time the service is used. For example, a user browses the network to pick a default printer fairly rarely, but once a default printer has been picked, that named service is resolved to its current IP address and port number every time the user presses Cmd-P to print.
|-P name type domain port host IP [key=value ...]|
create a proxy advertisement for a service running on(offered by) some other machine.
The two new options are Host, a name for the device and IP, the address of it.
The service for which you create a proxy advertisement does not necessarily have to be on your local network. You can set up a local proxy for a website on the Internet.
|-q name rrtype rrclass|
look up any DNS name, resource record type, and resource record class,
not necessarily DNS-SD names and record types.
If rrtype is not specified, it queries for the IPv4 address of the name,
if rrclass is not specified, IN class is assumed. If the name is not a fully
qualified domain name, then search domains may be appended.
|-Z type domain|
browse for service instances and display output in zone file format.
|-G- v4/v6/v4v6 name|
look up the IP address information of the name.
If v4 is specified, the IPv4 address of the name is looked up,
if v6 is specified the IPv6 address is looked up. If v4v6 is specified both the IPv4 and IPv6
address is looked up. If the name is not a fully qualified domain name,
then search domains may be appended.
|-V||return the version of the currently running daemon/system service.|
To advertise the existence of LPR printing service on port 515 on this machine, such that it will be discovered by the Mac OS X printing software and other DNS-SD compatible printing clients, use:
-R- -My Test -_printer._tcp. -. -515 -pdl=application/postscript
For this registration to be useful, you need to actually have LPR service available on port 515. Advertising a service that does not exist is not very useful, and will be confusing and annoying to other people on the network.
Similarly, to advertise a web page being served by an HTTP server on port 80 on this machine, such that it will show up in the Bonjour list in Safari and other DNS-SD compatible Web clients, use:
-R- -My Test -_http._tcp -. -80 -path=/path-to-page.html
To find the advertised web pages on the local network (the same list that Safari shows), use:
While that command is running, in another window, try the -R example given above to advertise a web page, and you should see the "Add" event reported to the -B window. Now press Ctrl-C in the -R window and you should see the "Remove" event reported to the -B window.
In the example below, the www.apple.com web page is advertised as a service called "apple", running on a target host called apple.local, which resolves to 126.96.36.199.
-P- apple -_http._tcp - - - -80 -apple.local -188.8.131.52
The Bonjour menu in the Safari web browser will now show "apple". The same IP address can be reached by entering apple.local in the web browser. In either case, the request will be resolved to the IP address and browser will show contents associated with www.apple.com.
If a client wants to be notified of changes in server state, it can initiate a query for the services particular record and leave it running. For example, to monitor the status of an iChat user you can use:
-q- someone@ex1._presence._tcp.local -txt
Everytime status of that user(someone) changes, you will see a new TXT record result reported.
You can also query for a unicast name like www.apple.com and monitor its status.
dns-sd bugs are tracked in Apple Radar component "mDNSResponder".
The dns-sd command first appeared in Mac OS X 10.4 (Tiger).