xref: /titanic_52/usr/src/man/man1m/dns-sd.1m (revision 5ffb0c9b03b5149ff4f5821a62be4a52408ada2a)
1*5ffb0c9bSToomas Soome.\" -*- tab-width: 4 -*-
2*5ffb0c9bSToomas Soome.\"
3*5ffb0c9bSToomas Soome.\" Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
4*5ffb0c9bSToomas Soome.\"
5*5ffb0c9bSToomas Soome.\" Licensed under the Apache License, Version 2.0 (the "License");
6*5ffb0c9bSToomas Soome.\" you may not use this file except in compliance with the License.
7*5ffb0c9bSToomas Soome.\" You may obtain a copy of the License at
8*5ffb0c9bSToomas Soome.\"
9*5ffb0c9bSToomas Soome.\"     http://www.apache.org/licenses/LICENSE-2.0
10*5ffb0c9bSToomas Soome.\"
11*5ffb0c9bSToomas Soome.\" Unless required by applicable law or agreed to in writing, software
12*5ffb0c9bSToomas Soome.\" distributed under the License is distributed on an "AS IS" BASIS,
13*5ffb0c9bSToomas Soome.\" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*5ffb0c9bSToomas Soome.\" See the License for the specific language governing permissions and
15*5ffb0c9bSToomas Soome.\" limitations under the License.
16*5ffb0c9bSToomas Soome.\"
17*5ffb0c9bSToomas Soome.\" Copyright 2016 Toomas Soome <tsoome@me.com>
18*5ffb0c9bSToomas Soome.\"
19*5ffb0c9bSToomas Soome.Dd Jan 28, 2016            \" Date
20*5ffb0c9bSToomas Soome.Dt DNS-SD 1M               \" Document Title
21*5ffb0c9bSToomas Soome.Os illumos                 \" Operating System
22*5ffb0c9bSToomas Soome.\"
23*5ffb0c9bSToomas Soome.Sh NAME
24*5ffb0c9bSToomas Soome.Nm dns-sd
25*5ffb0c9bSToomas Soome.Nd Multicast DNS (mDNS) & DNS Service Discovery (DNS-SD) Test Tool \" For whatis
26*5ffb0c9bSToomas Soome.\"
27*5ffb0c9bSToomas Soome.Sh SYNOPSIS
28*5ffb0c9bSToomas Soome.Nm
29*5ffb0c9bSToomas Soome.Op Fl E
30*5ffb0c9bSToomas Soome.Pp
31*5ffb0c9bSToomas Soome.Nm
32*5ffb0c9bSToomas Soome.Op Fl F
33*5ffb0c9bSToomas Soome.Pp
34*5ffb0c9bSToomas Soome.Nm
35*5ffb0c9bSToomas Soome.Op Fl R Ar name type domain port Op Ar key=value ...
36*5ffb0c9bSToomas Soome.Pp
37*5ffb0c9bSToomas Soome.Nm
38*5ffb0c9bSToomas Soome.Op Fl B Ar      type domain
39*5ffb0c9bSToomas Soome.Pp
40*5ffb0c9bSToomas Soome.Nm
41*5ffb0c9bSToomas Soome.Op Fl L Ar name type domain
42*5ffb0c9bSToomas Soome.Pp
43*5ffb0c9bSToomas Soome.Nm
44*5ffb0c9bSToomas Soome.Op Fl P Ar name type domain port host IP Op Ar key=value ...
45*5ffb0c9bSToomas Soome.Pp
46*5ffb0c9bSToomas Soome.Nm
47*5ffb0c9bSToomas Soome.Op Fl q Ar name rrtype rrclass
48*5ffb0c9bSToomas Soome.Pp
49*5ffb0c9bSToomas Soome.Nm
50*5ffb0c9bSToomas Soome.Op Fl Z Ar      type domain
51*5ffb0c9bSToomas Soome.Pp
52*5ffb0c9bSToomas Soome.Nm
53*5ffb0c9bSToomas Soome.Op Fl G Ns \ v4/v6/v4v6 Ar      name
54*5ffb0c9bSToomas Soome.Pp
55*5ffb0c9bSToomas Soome.Nm
56*5ffb0c9bSToomas Soome.Op Fl V
57*5ffb0c9bSToomas Soome.\"
58*5ffb0c9bSToomas Soome.Sh DESCRIPTION
59*5ffb0c9bSToomas SoomeThe
60*5ffb0c9bSToomas Soome.Nm
61*5ffb0c9bSToomas Soomecommand is a network diagnostic tool, much like
62*5ffb0c9bSToomas Soome.Xr ping 8
63*5ffb0c9bSToomas Soomeor
64*5ffb0c9bSToomas Soome.Xr traceroute 8 .
65*5ffb0c9bSToomas SoomeHowever, unlike those tools, most of its functionality is not implemented in the
66*5ffb0c9bSToomas Soome.Nm
67*5ffb0c9bSToomas Soomeexecutable itself, but in library code that is available to any application.
68*5ffb0c9bSToomas SoomeThe library API that
69*5ffb0c9bSToomas Soome.Nm
70*5ffb0c9bSToomas Soomeuses is documented in
71*5ffb0c9bSToomas Soome.Pa /usr/include/dns_sd.h .
72*5ffb0c9bSToomas SoomeThe
73*5ffb0c9bSToomas Soome.Nm
74*5ffb0c9bSToomas Soomecommand replaces the older
75*5ffb0c9bSToomas SoomemDNS
76*5ffb0c9bSToomas Soomecommand.
77*5ffb0c9bSToomas Soome.Pp
78*5ffb0c9bSToomas SoomeThe
79*5ffb0c9bSToomas Soome.Nm
80*5ffb0c9bSToomas Soomecommand is primarily intended for interactive use.
81*5ffb0c9bSToomas SoomeBecause its command-line arguments and output format are subject to change,
82*5ffb0c9bSToomas Soomeinvoking it from a shell script will generally be fragile. Additionally,
83*5ffb0c9bSToomas Soomethe asynchronous nature of DNS Service Discovery does
84*5ffb0c9bSToomas Soomenot lend itself easily to script-oriented programming. For example,
85*5ffb0c9bSToomas Soomecalls like "browse" never complete; the action of performing a "browse"
86*5ffb0c9bSToomas Soomesets in motion machinery to notify the client whenever instances of
87*5ffb0c9bSToomas Soomethat service type appear or disappear from the network. These
88*5ffb0c9bSToomas Soomenotifications continue to be delivered indefinitely, for minutes,
89*5ffb0c9bSToomas Soomehours, or even days, as services come and go, until the client
90*5ffb0c9bSToomas Soomeexplicitly terminates the call. This style of asynchronous interaction
91*5ffb0c9bSToomas Soomeworks best with applications that are either multi-threaded, or use a
92*5ffb0c9bSToomas Soomemain event-handling loop to receive keystrokes, network data, and other
93*5ffb0c9bSToomas Soomeasynchronous event notifications as they happen.
94*5ffb0c9bSToomas Soome.br
95*5ffb0c9bSToomas SoomeIf you wish to perform DNS Service Discovery operations from a
96*5ffb0c9bSToomas Soomescripting language, then the best way to do this is not to execute the
97*5ffb0c9bSToomas Soome.Nm
98*5ffb0c9bSToomas Soomecommand and then attempt to decipher the textual output, but instead to
99*5ffb0c9bSToomas Soomedirectly call the DNS-SD APIs using a binding for your chosen language.
100*5ffb0c9bSToomas Soome.br
101*5ffb0c9bSToomas SoomeFor example, if you are programming in Ruby, then you can
102*5ffb0c9bSToomas Soomedirectly call DNS-SD APIs using the dnssd package documented at
103*5ffb0c9bSToomas Soome.Pa <http://rubyforge.org/projects/dnssd/> .
104*5ffb0c9bSToomas Soome.br
105*5ffb0c9bSToomas SoomeSimilar bindings for other languages are also in development.
106*5ffb0c9bSToomas Soome.Bl -tag -width E
107*5ffb0c9bSToomas Soome.It Nm Fl E
108*5ffb0c9bSToomas Soomereturn a list of domains recommended for registering(advertising) services.
109*5ffb0c9bSToomas Soome.It Nm Fl F
110*5ffb0c9bSToomas Soomereturn a list of domains recommended for browsing services.
111*5ffb0c9bSToomas Soome.Pp
112*5ffb0c9bSToomas SoomeNormally, on your home network, the only domain you are likely to see is "local".
113*5ffb0c9bSToomas SoomeHowever if your network administrator has created Domain Enumeration records,
114*5ffb0c9bSToomas Soomethen you may also see other recommended domains for registering and browsing.
115*5ffb0c9bSToomas Soome.It Nm Fl R Ar name type domain port Op Ar key=value ...
116*5ffb0c9bSToomas Soomeregister (advertise) a service in the specified
117*5ffb0c9bSToomas Soome.Ar domain
118*5ffb0c9bSToomas Soomewith the given
119*5ffb0c9bSToomas Soome.Ar name
120*5ffb0c9bSToomas Soomeand
121*5ffb0c9bSToomas Soome.Ar type
122*5ffb0c9bSToomas Soomeas listening (on the current machine) on
123*5ffb0c9bSToomas Soome.Ar port.
124*5ffb0c9bSToomas Soome.Pp
125*5ffb0c9bSToomas Soome.Ar name
126*5ffb0c9bSToomas Soomecan be arbitrary unicode text, containing any legal unicode characters
127*5ffb0c9bSToomas Soome(including dots, spaces, slashes, colons, etc. without restriction),
128*5ffb0c9bSToomas Soomeup to 63 UTF-8 bytes long.
129*5ffb0c9bSToomas Soome.Ar type
130*5ffb0c9bSToomas Soomemust be of the form "_app-proto._tcp" or "_app-proto._udp", where
131c10c16deSRichard Lowe"app-proto" is an application protocol name registered at
132*5ffb0c9bSToomas Soome.Pa http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml .
133*5ffb0c9bSToomas Soome.Pp
134*5ffb0c9bSToomas Soome.Ar domain
135*5ffb0c9bSToomas Soomeis the domain in which to register the service.
136*5ffb0c9bSToomas SoomeIn current implementations, only the local multicast domain "local" is
137*5ffb0c9bSToomas Soomesupported. In the future, registering will be supported in any arbitrary
138*5ffb0c9bSToomas Soomedomain that has a working DNS Update server [RFC 2136]. The
139*5ffb0c9bSToomas Soome.Ar domain
140*5ffb0c9bSToomas Soome"." is a synonym for "pick a sensible default" which today
141*5ffb0c9bSToomas Soomemeans "local".
142*5ffb0c9bSToomas Soome.Pp
143*5ffb0c9bSToomas Soome.Ar port
144*5ffb0c9bSToomas Soomeis a number from 0 to 65535, and is the TCP or UDP port number upon
145*5ffb0c9bSToomas Soomewhich the service is listening.
146*5ffb0c9bSToomas Soome.Pp
147c10c16deSRichard LoweAdditional attributes of the service may optionally be described by
148*5ffb0c9bSToomas Soomekey/value pairs, which are stored in the advertised service's DNS TXT
149*5ffb0c9bSToomas Soomerecord. Allowable keys and values are listed with the service
150*5ffb0c9bSToomas Soomeregistration at
151*5ffb0c9bSToomas Soome.Pa http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml .
152*5ffb0c9bSToomas Soome.It Nm Fl B Ar type domain
153*5ffb0c9bSToomas Soomebrowse for instances of service
154*5ffb0c9bSToomas Soome.Ar type
155*5ffb0c9bSToomas Soomein
156*5ffb0c9bSToomas Soome.Ar domain .
157*5ffb0c9bSToomas Soome.Pp
158*5ffb0c9bSToomas SoomeFor valid
159*5ffb0c9bSToomas Soome.Ar type Ns s
160*5ffb0c9bSToomas Soomesee
161*5ffb0c9bSToomas Soome.Pa http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml .
162*5ffb0c9bSToomas Soomeas described above. Omitting the
163*5ffb0c9bSToomas Soome.Ar domain
164*5ffb0c9bSToomas Soomeor using "." means "pick a sensible default."
165*5ffb0c9bSToomas Soome.It Nm Fl L Ar name type domain
166*5ffb0c9bSToomas Soomelook up and display the information necessary to contact and use the
167*5ffb0c9bSToomas Soomenamed service: the hostname of the machine where that service is
168*5ffb0c9bSToomas Soomeavailable, the port number on which the service is listening, and (if
169*5ffb0c9bSToomas Soomepresent) TXT record attributes describing properties of the service.
170*5ffb0c9bSToomas Soome.Pp
171*5ffb0c9bSToomas SoomeNote that in a typical application, browsing may only happen rarely, while lookup
172*5ffb0c9bSToomas Soome(or "resolving") happens every time the service is used. For example, a
173*5ffb0c9bSToomas Soomeuser browses the network to pick a default printer fairly rarely, but once
174*5ffb0c9bSToomas Soomea default printer has been picked, that named service is resolved to its
175*5ffb0c9bSToomas Soomecurrent IP address and port number every time the user presses Cmd-P to
176*5ffb0c9bSToomas Soomeprint.
177*5ffb0c9bSToomas Soome.It Nm Fl P Ar name type domain port host IP Op Ar key=value ...
178*5ffb0c9bSToomas Soomecreate a proxy advertisement for a service running on(offered by) some other machine.
179*5ffb0c9bSToomas SoomeThe two new options are Host, a name for the device and IP, the address of it.
180*5ffb0c9bSToomas Soome.Pp
181*5ffb0c9bSToomas SoomeThe service for which you create a proxy advertisement does not necessarily have to be on your local network.
182*5ffb0c9bSToomas SoomeYou can set up a local proxy for a website on the Internet.
183*5ffb0c9bSToomas Soome.It Nm Fl q Ar name rrtype rrclass
184*5ffb0c9bSToomas Soomelook up any DNS name, resource record type, and resource record class,
185*5ffb0c9bSToomas Soomenot necessarily DNS-SD names and record types.
186*5ffb0c9bSToomas SoomeIf rrtype is not specified, it queries for the IPv4 address of the name,
187*5ffb0c9bSToomas Soomeif rrclass is not specified, IN class is assumed. If the name is not a fully
188*5ffb0c9bSToomas Soomequalified domain name, then search domains may be appended.
189*5ffb0c9bSToomas Soome.It Nm Fl Z Ar type domain
190*5ffb0c9bSToomas Soomebrowse for service instances and display output in zone file format.
191*5ffb0c9bSToomas Soome.It Nm Fl G Ns \ v4/v6/v4v6 Ar name
192*5ffb0c9bSToomas Soomelook up the IP address information of the name.
193*5ffb0c9bSToomas SoomeIf v4 is specified, the IPv4 address of the name is looked up,
194*5ffb0c9bSToomas Soomeif v6 is specified the IPv6 address is looked up. If v4v6 is specified both the IPv4 and IPv6
195*5ffb0c9bSToomas Soomeaddress is looked up. If the name is not a fully qualified domain name,
196*5ffb0c9bSToomas Soomethen search domains may be appended.
197*5ffb0c9bSToomas Soome.It Nm Fl V
198*5ffb0c9bSToomas Soomereturn the version of the currently running daemon/system service.
199*5ffb0c9bSToomas Soome.El
200*5ffb0c9bSToomas Soome.Sh FILES
201*5ffb0c9bSToomas Soome.Pa /usr/bin/dns-sd \" Pathname
202*5ffb0c9bSToomas Soome.\"
203*5ffb0c9bSToomas Soome.Sh EXAMPLES
204*5ffb0c9bSToomas SoomeTo advertise the existence of LPR printing service on port 515 on this
205*5ffb0c9bSToomas Soomemachine, such that it will be discovered by the Mac OS X printing software
206*5ffb0c9bSToomas Soomeand other DNS-SD compatible printing clients, use:
207*5ffb0c9bSToomas Soome.Pp
208*5ffb0c9bSToomas Soome.Dl Nm Fl R Ns \ \&"My Test\&" _printer._tcp. \&. 515 pdl=application/postscript
209*5ffb0c9bSToomas Soome.Pp
210*5ffb0c9bSToomas SoomeFor this registration to be useful, you need to actually have LPR service
211*5ffb0c9bSToomas Soomeavailable on port 515. Advertising a service that does not exist is not
212*5ffb0c9bSToomas Soomevery useful, and will be confusing and annoying to other people on the
213*5ffb0c9bSToomas Soomenetwork.
214*5ffb0c9bSToomas Soome.Pp
215*5ffb0c9bSToomas SoomeSimilarly, to advertise a web page being served by an HTTP
216*5ffb0c9bSToomas Soomeserver on port 80 on this machine, such that it will show up in the
217*5ffb0c9bSToomas SoomeBonjour list in Safari and other DNS-SD compatible Web clients, use:
218*5ffb0c9bSToomas Soome.Pp
219*5ffb0c9bSToomas Soome.Dl Nm Fl R Ns \ \&"My Test\&" _http._tcp \&. 80 path=/path-to-page.html
220*5ffb0c9bSToomas Soome.Pp
221*5ffb0c9bSToomas SoomeTo find the advertised web pages on the local network (the same list that
222*5ffb0c9bSToomas SoomeSafari shows), use:
223*5ffb0c9bSToomas Soome.Pp
224*5ffb0c9bSToomas Soome.Dl Nm Fl B Ns \ _http._tcp
225*5ffb0c9bSToomas Soome.Pp
226*5ffb0c9bSToomas SoomeWhile that command is running, in another window, try the
227*5ffb0c9bSToomas Soome.Nm Fl R
228*5ffb0c9bSToomas Soomeexample given above to advertise a web page, and you should see the
229*5ffb0c9bSToomas Soome"Add" event reported to the
230*5ffb0c9bSToomas Soome.Nm Fl B
231*5ffb0c9bSToomas Soomewindow. Now press Ctrl-C in the
232*5ffb0c9bSToomas Soome.Nm Fl R
233*5ffb0c9bSToomas Soomewindow and you should see the "Remove" event reported to the
234*5ffb0c9bSToomas Soome.Nm Fl B
235*5ffb0c9bSToomas Soomewindow.
236*5ffb0c9bSToomas Soome.Pp
237*5ffb0c9bSToomas SoomeIn the example below, the www.apple.com web page is advertised as a service called "apple",
238*5ffb0c9bSToomas Soomerunning on a target host called apple.local, which resolves to 17.149.160.49.
239*5ffb0c9bSToomas Soome.Pp
240*5ffb0c9bSToomas Soome.Dl Nm Fl P Ns \ apple _http._tcp \&"\&"\& 80 apple.local 17.149.160.49
241*5ffb0c9bSToomas Soome.Pp
242*5ffb0c9bSToomas SoomeThe Bonjour menu in the Safari web browser will now show "apple".
243*5ffb0c9bSToomas SoomeThe same IP address can be reached by entering apple.local in the web browser.
244*5ffb0c9bSToomas SoomeIn either case, the request will be resolved to the IP address and browser will show
245*5ffb0c9bSToomas Soomecontents associated with www.apple.com.
246*5ffb0c9bSToomas Soome.Pp
247*5ffb0c9bSToomas SoomeIf a client wants to be notified of changes in server state, it can
248*5ffb0c9bSToomas Soomeinitiate a query for the service's particular record and leave it running.
249*5ffb0c9bSToomas SoomeFor example, to monitor the status of an iChat user you can use:
250*5ffb0c9bSToomas Soome.Pp
251*5ffb0c9bSToomas Soome.Dl Nm Fl q Ns \ someone@ex1._presence._tcp.local txt
252*5ffb0c9bSToomas Soome.Pp
253*5ffb0c9bSToomas SoomeEverytime status of that user(someone) changes, you will see a new TXT record result reported.
254*5ffb0c9bSToomas Soome.Pp
255*5ffb0c9bSToomas SoomeYou can also query for a unicast name like www.apple.com and monitor its status.
256*5ffb0c9bSToomas Soome.Pp
257*5ffb0c9bSToomas Soome.Dl Nm Fl q Ns \ www.apple.com
258*5ffb0c9bSToomas Soome.Sh INTERFACE STABILITY
259*5ffb0c9bSToomas Soome.Sy Volatile .
260*5ffb0c9bSToomas Soome.Sh SEE ALSO
261*5ffb0c9bSToomas Soome.Xr mdnsd 1M ,
262*5ffb0c9bSToomas Soome.Xr ping 1M ,
263*5ffb0c9bSToomas Soome.Xr traceroute 1M ,
264*5ffb0c9bSToomas Soome.Xr resolv.conf 4
265