1dns-sd(1M) System Administration Commands dns-sd(1M)
2
3
4
6 dns-sd - Multicast DNS (mDNS) & DNS Service Discovery (DNS-SD) Test
7 Tool
8
10 dns-sd -R name type domain port [key=value ...]
11
12
13 dns-sd -B type domain
14
15
16 dns-sd -L name type domain
17
18
19 dns-sd -Q FQDN rrtype rrclass
20
21
22 dns-sd -C FQDN rrtype rrclass
23
24
25 dns-sd -P name type domain port host IP [key=value ...]
26
27
28 dns-sd -E | -F | -A | -U | -N | -T | -M | -I
29
30
32 The dns-sd command is a network diagnostic tool, much like ping(1M) or
33 traceroute(1M). However, unlike those tools, most of its functionality
34 is not implemented in the dns-sd executable itself, but in library code
35 that is available to any application. The library API that dns-sd uses
36 is documented in /usr/include/dns_sd.h.
37
38
39 The dns-sd command is primarily intended for interactive use. Because
40 its command-line arguments and output format are subject to change,
41 invoking it from a shell script can be unpredictable. Additionally, the
42 asynchronous nature of DNS Service Discovery does not easily lend
43 itself to script-oriented programming. This style of asynchronous
44 interaction works best with applications that are either multi-
45 threaded, or use a main event-handling loop to receive keystrokes, net‐
46 work data, and other asynchronous event notifications as they happen.
47
49 The following options are supported:
50
51 -R name type domain port [key=value ...]
52
53 Register (advertise) a service in the specified domain with the
54 given name and type as listening (on the current machine) on the
55 specified port.
56
57 name can be any arbitrary unicode text, containing any legal uni‐
58 code characters (including dots, spaces, slashes, colons, and so on
59 without any restrictions), up to 63 UTF-8 bytes long.
60
61 type must be of the form "_app-proto._tcp" or "_app-proto._udp",
62 where "app-proto" is an application protocol name registered at
63 http://www.dns-sd.org/ServiceTypes.html.
64
65 domain is the domain in which to register the service. In current
66 implementations, only the local multicast domain "local" is sup‐
67 ported. In the future, registering will be supported in any arbi‐
68 trary domain that has a working DNS Update server [RFC 2136]. The
69 domain "." is a synonym for "pick a sensible default", which cur‐
70 rently means "local".
71
72 port is a number from 0 to 65535, and is the TCP or UDP port number
73 upon which the service is listening. Registering a service on port
74 0 allows an application to explicitly advertise the non-availabil‐
75 ity of a service.
76
77 Additional attributes of the service may optionally be described by
78 key/value pairs, which are stored in the advertised service's DNS
79 TXT record. Allowable keys and values are listed with the service
80 registration at http://www.dns-sd.org/ServiceTypes.html
81
82
83 -B type domain
84
85 Browse for instances of service type in domain.
86
87 For valid types, see http://www.dns-sd.org/ServiceTypes.html. Omit‐
88 ting the domain name or using "." means "pick a sensible default."
89
90
91 -L name type domain
92
93 Look up and display the information necessary to contact and use
94 the named service. This information includes the hostname of the
95 machine where that service is available, the port number on which
96 the service is listening, and (if present) TXT record attributes
97 describing properties of the service.
98
99 In a typical application, browsing happens rarely, while lookup (or
100 "resolving") happens every time the service is used. For example, a
101 user does not browse the network to pick a default printer that
102 often, but once a default printer has been picked, that named ser‐
103 vice is resolved to its current IP address and port number every
104 time the user presses Cmd-P to print.
105
106
107 -Q FQDN rrtype rrclass
108
109 Generic query for any resource record type and class.
110
111
112 -C FQDN rrtype rrclass
113
114 Generic query for any resource record type and class. This option
115 also reconfirms each result from the query. Reconfirming the record
116 instructs mdnsd(1M) to verify the validity of the record. If the
117 record is not valid mdnsd(1M) flushes the record from the daemon's
118 cache and also from other mdnsd(1M) caches on the network.
119
120
121 -P name type domain port host IP [key=value ...]
122
123 Register (advertise) a service in the specified domain with the
124 given name and type listening on the specified port and accessible
125 on another host. This option should be used to advertise by proxy a
126 service accessible on another host. The host name and IPv4 address
127 to access the service must be specified.
128
129
130 -E
131
132 Discover recommended registration domains. This option returns the
133 recommended domains to register a service. The recommended regis‐
134 tration domains are returned by querying the name servers in
135 resolv.conf(4).
136
137
138 -F
139
140 Discover recommended browsing domains. This option returns the rec‐
141 ommended domains for browsing services. The recommended browsing
142 domains are returned by querying the name servers in
143 resolv.conf(4).
144
145
146 -A
147
148 Test registering service with Multicast DNS and test the add,
149 update and delete operations of DNS records with Multicast DNS.
150
151
152 -U
153
154 Test registering service with Multicast DNS and test updating of
155 DNS TXT records for a service registered with Multicast DNS.
156
157
158 -N
159
160 Test adding a large NULL record for a service registered with Mul‐
161 ticast DNS.
162
163
164 -T
165
166 Test adding a large TXT record for a service registered with Multi‐
167 cast DNS.
168
169
170 -M
171
172 Test creating a registration with multiple TXT records.
173
174
175 -I
176
177 Test registering and then immediately updating a TXT record.
178
179
181 Example 1 Advertising a printing service
182
183
184 The following command advertises the existence of LPR printing service
185 on port 515 on this machine, so that it will be available to DNS-SD
186 compatible printing clients:
187
188
189 dns-sd -R "My Test" _printer._tcp. . 515 pdl=application/postscript
190
191
192
193
194 For this registration to be useful, the LPR service should be available
195 on port 515. Advertising a service that does not exist is not very use‐
196 ful.
197
198 Example 2 Advertising a web page
199
200
201 The following command advertises a web page being served by an HTTP
202 server on port 80 on this machine, so that it will appear on the Bon‐
203 jour list in Safari and other DNS-SD compatible Web clients:
204
205
206 dns-sd -R "My Test" _http._tcp . 80 path=/path-to-page.html
207
208
209
210 Example 3 Finding the advertised web pages on the local network
211
212
213 The following command finds the advertised web pages on the local net‐
214 work (the same list that Safari shows):
215
216
217 dns-sd -B _http._tcp
218
219
220
222 See attributes(5) for descriptions of the following attributes:
223
224
225
226
227 ┌─────────────────────────────┬─────────────────────────────┐
228 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
229 ├─────────────────────────────┼─────────────────────────────┤
230 │Availability │SUNWdsdu │
231 ├─────────────────────────────┼─────────────────────────────┤
232 │Interface Stability │Volatile │
233 └─────────────────────────────┴─────────────────────────────┘
234
236 mdnsd(1M), ping(1M), traceroute(1M), resolv.conf(4), attributes(5)
237
238
239
240SunOS 5.11 21 Aug 2007 dns-sd(1M)