xref: /aosp_15_r20/external/libcups/doc/help/network.html (revision 5e7646d21f1134fb0638875d812ef646c12ab91e)
1*5e7646d2SAndroid Build Coastguard Worker<!DOCTYPE html>
2*5e7646d2SAndroid Build Coastguard Worker<html>
3*5e7646d2SAndroid Build Coastguard Worker<!-- SECTION: Getting Started -->
4*5e7646d2SAndroid Build Coastguard Worker  <head>
5*5e7646d2SAndroid Build Coastguard Worker    <title>Using Network Printers</title>
6*5e7646d2SAndroid Build Coastguard Worker    <link rel="stylesheet" type="text/css" href="../cups-printable.css">
7*5e7646d2SAndroid Build Coastguard Worker  </head>
8*5e7646d2SAndroid Build Coastguard Worker  <body>
9*5e7646d2SAndroid Build Coastguard Worker    <h1 class="title">Using Network Printers</h1>
10*5e7646d2SAndroid Build Coastguard Worker
11*5e7646d2SAndroid Build Coastguard Worker    <p>This help document describes how to discover, configure, and use TCP/IP network printers with CUPS.</p>
12*5e7646d2SAndroid Build Coastguard Worker
13*5e7646d2SAndroid Build Coastguard Worker    <h2 class="title" id="AUTOMATIC">Automatic Configuration Using Bonjour</h2>
14*5e7646d2SAndroid Build Coastguard Worker
15*5e7646d2SAndroid Build Coastguard Worker    <p>Most network printers support a protocol known as Bonjour, which is a combination of zero-configuration networking ("ZeroConf"), multicast DNS (mDNS), and DNS service discovery (DNS-SD) standards published by the Internet Engineering Task Force (IETF), the same group that defined TCP/IP and all of the networking we use today.</p>
16*5e7646d2SAndroid Build Coastguard Worker
17*5e7646d2SAndroid Build Coastguard Worker    <p>A printer that supports Bonjour can be found automatically using the <code>dnssd</code> backend. Run the <code>lpinfo(8)</code> command to find your printer's URI:</p>
18*5e7646d2SAndroid Build Coastguard Worker
19*5e7646d2SAndroid Build Coastguard Worker    <pre class="command">lpinfo --include-schemes dnssd -v
20*5e7646d2SAndroid Build Coastguard Workernetwork dnssd://Acme%20Laser%20Pro._ipp._tcp.local./?uuid=545253fb-1cb7-4d8d-98ed-ab6cd607cea7
21*5e7646d2SAndroid Build Coastguard Workernetwork dnssd://Bar99._printer.tcp.local./?uuid=f9efff58-9086-4c95-accb-81dee876a475
22*5e7646d2SAndroid Build Coastguard Workernetwork dnssd://Example%20EX-42._ipps._tcp.local./?uuid=4a0c67ad-2824-4ddf-9115-7d4226c5fe65
23*5e7646d2SAndroid Build Coastguard Workernetwork dnssd://Foo%20Fighter-1969._pdl-datastream._tcp.local./?uuid=4e216bea-c3de-4f65-a710-c99e11c80d2b</pre>
24*5e7646d2SAndroid Build Coastguard Worker
25*5e7646d2SAndroid Build Coastguard Worker    <p>You can then <a href="admin.html#PRINTERS">add a printer</a> using the URI reported.</p>
26*5e7646d2SAndroid Build Coastguard Worker
27*5e7646d2SAndroid Build Coastguard Worker
28*5e7646d2SAndroid Build Coastguard Worker    <h2 class="title" id="MANUAL">Manual Configuration Using IP Addresses</h2>
29*5e7646d2SAndroid Build Coastguard Worker
30*5e7646d2SAndroid Build Coastguard Worker    <p>You can also manually configure a printer using its Internet Protocol v4 (IPv4) address. This address is either configured manually ("static IP") through the printer's control panel or set using an automatic network protocol such as the Dynamic Host Control Protocol (DHCP) or ZeroConf.</p>
31*5e7646d2SAndroid Build Coastguard Worker
32*5e7646d2SAndroid Build Coastguard Worker    <blockquote><b>Note:</b> Configuring a printer using an IP address set using DHCP or ZeroConf is not recommended since the address will change every time the printer is turned on or after long periods of inactivity. Thus, every time the address changes you will need to modify the print queue using the <code>lpadmin</code> command.</blockquote>
33*5e7646d2SAndroid Build Coastguard Worker
34*5e7646d2SAndroid Build Coastguard Worker    <h3>Finding the IP Address</h3>
35*5e7646d2SAndroid Build Coastguard Worker
36*5e7646d2SAndroid Build Coastguard Worker    <p>You can normally find the IP address of a printer on the printer's control panel or by printing the configuration or status page. The <a href="#SNMP">Simple Network Management Protocol (SNMP)</a> can also be used to get the IP address remotely. To test that the IP address has been successfully assigned and that the printer is properly connected to your LAN or Wi-Fi network, type:</p>
37*5e7646d2SAndroid Build Coastguard Worker
38*5e7646d2SAndroid Build Coastguard Worker    <pre class="command">ping ip-address</pre>
39*5e7646d2SAndroid Build Coastguard Worker
40*5e7646d2SAndroid Build Coastguard Worker    <p>where "ip-address" is the address reported by the printer's control panel, configuration page, and/or status page. If the connection is working properly you will see something like:</p>
41*5e7646d2SAndroid Build Coastguard Worker
42*5e7646d2SAndroid Build Coastguard Worker    <pre class="command">ping 10.0.1.42
43*5e7646d2SAndroid Build Coastguard WorkerPING 10.0.1.42 (10.0.1.42): 56 data bytes
44*5e7646d2SAndroid Build Coastguard Worker64 bytes from 10.0.1.42: icmp_seq=0 ttl=15 time=1.123 ms
45*5e7646d2SAndroid Build Coastguard Worker64 bytes from 10.0.1.42: icmp_seq=1 ttl=15 time=2.034 ms
46*5e7646d2SAndroid Build Coastguard Worker64 bytes from 10.0.1.42: icmp_seq=2 ttl=15 time=1.765 ms
47*5e7646d2SAndroid Build Coastguard Worker64 bytes from 10.0.1.42: icmp_seq=3 ttl=15 time=1.234 ms
48*5e7646d2SAndroid Build Coastguard Worker...</pre>
49*5e7646d2SAndroid Build Coastguard Worker
50*5e7646d2SAndroid Build Coastguard Worker    <p>If the connection is not working properly you will see something like:</p>
51*5e7646d2SAndroid Build Coastguard Worker
52*5e7646d2SAndroid Build Coastguard Worker    <pre class="command">ping 10.0.1.42
53*5e7646d2SAndroid Build Coastguard WorkerPING 10.0.1.42 (10.0.1.42): 56 data bytes
54*5e7646d2SAndroid Build Coastguard WorkerRequest timeout for icmp_seq 0
55*5e7646d2SAndroid Build Coastguard WorkerRequest timeout for icmp_seq 1
56*5e7646d2SAndroid Build Coastguard Worker...</pre>
57*5e7646d2SAndroid Build Coastguard Worker
58*5e7646d2SAndroid Build Coastguard Worker    <p>Press <kbd>CTRL+C</kbd> to quit the <code>ping</code> command.</p>
59*5e7646d2SAndroid Build Coastguard Worker
60*5e7646d2SAndroid Build Coastguard Worker    <blockquote><b>Note:</b> If the command does not show responses from the printer, verify that the printer or print server is powered on and connected to the same LAN or Wi-Fi network as your computer. For LAN connections, also verify that your network cabling is good.</blockquote>
61*5e7646d2SAndroid Build Coastguard Worker
62*5e7646d2SAndroid Build Coastguard Worker
63*5e7646d2SAndroid Build Coastguard Worker    <h3>Choosing a Network Protocol (Backend)</h3>
64*5e7646d2SAndroid Build Coastguard Worker
65*5e7646d2SAndroid Build Coastguard Worker    <p>CUPS supports most network printers using one of three TCP/IP-based protocols: <a href="#SOCKET">AppSocket</a>, <a href="#IPP">Internet Printing Protocol</a>, and <a href="#LPD">Line Printer Daemon</a>. The following sections describe the options for each of the backends.</p>
66*5e7646d2SAndroid Build Coastguard Worker
67*5e7646d2SAndroid Build Coastguard Worker
68*5e7646d2SAndroid Build Coastguard Worker    <h4 id="SOCKET">AppSocket Protocol (aka JetDirect)</h4>
69*5e7646d2SAndroid Build Coastguard Worker
70*5e7646d2SAndroid Build Coastguard Worker    <p>The AppSocket protocol (sometimes also called the JetDirect protocol, owing to its origins with the HP JetDirect network interfaces) is the simplest and fastest network protocol used for printers. AppSocket printing normally happens over port 9100 and uses the <code>socket</code> backend. Device URIs for the <code>socket</code> backend look like this:</p>
71*5e7646d2SAndroid Build Coastguard Worker
72*5e7646d2SAndroid Build Coastguard Worker    <pre class="example">socket://ip-address
73*5e7646d2SAndroid Build Coastguard Workersocket://ip-address/?contimeout=30
74*5e7646d2SAndroid Build Coastguard Workersocket://ip-address/?waiteof=false
75*5e7646d2SAndroid Build Coastguard Workersocket://ip-address/?contimeout=30&amp;waiteof=false
76*5e7646d2SAndroid Build Coastguard Workersocket://ip-address:port-number/?...</pre>
77*5e7646d2SAndroid Build Coastguard Worker
78*5e7646d2SAndroid Build Coastguard Worker    <p>The "contimeout" option controls the number of seconds that the backend will wait to obtain a connection to the printer. The default is 1 week or 604800 seconds.</p>
79*5e7646d2SAndroid Build Coastguard Worker
80*5e7646d2SAndroid Build Coastguard Worker    <p>The "waiteof" option controls whether the <code>socket</code> backend waits for the printer to complete the printing of the job. The default is to wait (<code>waiteof=true</code>). Add <code>waiteof=false</code> to the URI to tell the backend not to wait.</p>
81*5e7646d2SAndroid Build Coastguard Worker
82*5e7646d2SAndroid Build Coastguard Worker    <blockquote><b>Note:</b> While the AppSocket protocol is simple and fast, it also offers no security and is often an attack vector with printers. Consider using the <a href="#IPP">Internet Printing Protocol</a> which supports encryption and other security features.</blockquote>
83*5e7646d2SAndroid Build Coastguard Worker
84*5e7646d2SAndroid Build Coastguard Worker
85*5e7646d2SAndroid Build Coastguard Worker    <h4 id="IPP">Internet Printing Protocol (IPP)</h4>
86*5e7646d2SAndroid Build Coastguard Worker
87*5e7646d2SAndroid Build Coastguard Worker    <p>IPP is the only protocol that CUPS supports natively and is supported by most network printers and print servers. IPP supports encryption and other security features over port 631 and uses the <code>http</code> (Windows), <code>ipp</code>, and <code>ipps</code> backends. Device URIs for these backends look like this:</p>
88*5e7646d2SAndroid Build Coastguard Worker
89*5e7646d2SAndroid Build Coastguard Worker    <pre class="example">http://ip-address-or-hostname:port-number/printers/name/.printer</i>
90*5e7646d2SAndroid Build Coastguard Workeripp://ip-address/ipp/print
91*5e7646d2SAndroid Build Coastguard Workeripp://ip-address-or-hostname/printers/name
92*5e7646d2SAndroid Build Coastguard Workeripps://ip-address/ipp/print
93*5e7646d2SAndroid Build Coastguard Workeripps://ip-address:443/ipp/print
94*5e7646d2SAndroid Build Coastguard Workeripps://ip-address-or-hostname/printers/name</pre>
95*5e7646d2SAndroid Build Coastguard Worker
96*5e7646d2SAndroid Build Coastguard Worker    <p>The backends supports many options, which are summarized in <a href="#TABLE2">Table 2</a>. Like all backends, options are added to the end of the URI using the URL form encoding format, for example:</p>
97*5e7646d2SAndroid Build Coastguard Worker
98*5e7646d2SAndroid Build Coastguard Worker    <pre class="example">ipp://10.0.1.42/ipp/print?version=1.1
99*5e7646d2SAndroid Build Coastguard Workeripps://10.0.1.42:443/ipp/print?waitjob=false&amp;waitprinter=false</pre>
100*5e7646d2SAndroid Build Coastguard Worker
101*5e7646d2SAndroid Build Coastguard Worker    <div class="table"><table summary="IPP URI Options">
102*5e7646d2SAndroid Build Coastguard Worker      <caption>Table 2: <A NAME="TABLE2">IPP URI Options</a></caption>
103*5e7646d2SAndroid Build Coastguard Worker      <thead>
104*5e7646d2SAndroid Build Coastguard Worker	<tr>
105*5e7646d2SAndroid Build Coastguard Worker	  <th>Option</th>
106*5e7646d2SAndroid Build Coastguard Worker	  <th>Description</th>
107*5e7646d2SAndroid Build Coastguard Worker	</tr>
108*5e7646d2SAndroid Build Coastguard Worker      </thead>
109*5e7646d2SAndroid Build Coastguard Worker      <tbody>
110*5e7646d2SAndroid Build Coastguard Worker	<tr>
111*5e7646d2SAndroid Build Coastguard Worker	  <td><code>contimeout=<I>seconds</I></code></td>
112*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies the number of seconds to wait for the connection to the printer to complete (default 1 week or 604800 seconds).</td>
113*5e7646d2SAndroid Build Coastguard Worker	</tr>
114*5e7646d2SAndroid Build Coastguard Worker	<tr>
115*5e7646d2SAndroid Build Coastguard Worker	  <td><code>encryption=always</code></td>
116*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the connection to the IPP printer should be encrypted using SSL.</td>
117*5e7646d2SAndroid Build Coastguard Worker	</tr>
118*5e7646d2SAndroid Build Coastguard Worker	<tr>
119*5e7646d2SAndroid Build Coastguard Worker	  <td><code>encryption=ifrequested</code></td>
120*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the connection to the IPP printer should only be encrypted if the printer requests it.</td>
121*5e7646d2SAndroid Build Coastguard Worker	</tr>
122*5e7646d2SAndroid Build Coastguard Worker	<tr>
123*5e7646d2SAndroid Build Coastguard Worker	  <td><code>encryption=never</code></td>
124*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the connection to the IPP printer should not be encrypted.</td>
125*5e7646d2SAndroid Build Coastguard Worker	</tr>
126*5e7646d2SAndroid Build Coastguard Worker	<tr>
127*5e7646d2SAndroid Build Coastguard Worker	  <td><code>encryption=required</code></td>
128*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the connection to the IPP printer should be encrypted using TLS.</td>
129*5e7646d2SAndroid Build Coastguard Worker	</tr>
130*5e7646d2SAndroid Build Coastguard Worker	<tr>
131*5e7646d2SAndroid Build Coastguard Worker	  <td><code>version=1.0</code></td>
132*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that version 1.0 of the IPP protocol should be used instead of the default version 2.0.</td>
133*5e7646d2SAndroid Build Coastguard Worker	</tr>
134*5e7646d2SAndroid Build Coastguard Worker	<tr>
135*5e7646d2SAndroid Build Coastguard Worker	  <td><code>version=1.1</code></td>
136*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that version 1.1 of the IPP protocol should be used instead of the default version 2.0.</td>
137*5e7646d2SAndroid Build Coastguard Worker	</tr>
138*5e7646d2SAndroid Build Coastguard Worker	<tr>
139*5e7646d2SAndroid Build Coastguard Worker	  <td><code>version=2.1</code></td>
140*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that version 2.1 of the IPP protocol should be used instead of the default version 2.0.</td>
141*5e7646d2SAndroid Build Coastguard Worker	</tr>
142*5e7646d2SAndroid Build Coastguard Worker	<tr>
143*5e7646d2SAndroid Build Coastguard Worker	  <td><code>waitjob=false</code></td>
144*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the IPP backend should not wait for the job to complete.</td>
145*5e7646d2SAndroid Build Coastguard Worker	</tr>
146*5e7646d2SAndroid Build Coastguard Worker	<tr>
147*5e7646d2SAndroid Build Coastguard Worker	  <td><code>waitprinter=false</code></td>
148*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the IPP backend should not wait for the printer to become idle before sending the print job.</td>
149*5e7646d2SAndroid Build Coastguard Worker	</tr>
150*5e7646d2SAndroid Build Coastguard Worker      </tbody>
151*5e7646d2SAndroid Build Coastguard Worker    </table></div>
152*5e7646d2SAndroid Build Coastguard Worker
153*5e7646d2SAndroid Build Coastguard Worker
154*5e7646d2SAndroid Build Coastguard Worker    <h4 id="LPD">Line Printer Daemon (LPD) Protocol (aka lpr)</h4>
155*5e7646d2SAndroid Build Coastguard Worker
156*5e7646d2SAndroid Build Coastguard Worker    <p>LPD is the original network printing protocol created for the Berkeley UNIX line printer daemon (spooler) and is supported by many network printers. LPD printing normally happens over port 515 and uses the <code>lpd</code> backend. Device URIsfor the <code>lpd</code> backend look like this:</p>
157*5e7646d2SAndroid Build Coastguard Worker
158*5e7646d2SAndroid Build Coastguard Worker    <pre class="example">lpd://ip-address/queue
159*5e7646d2SAndroid Build Coastguard Workerlpd://ip-address/queue?format=l
160*5e7646d2SAndroid Build Coastguard Workerlpd://ip-address/queue?format=l&amp;reserve=rfc1179</pre>
161*5e7646d2SAndroid Build Coastguard Worker
162*5e7646d2SAndroid Build Coastguard Worker    <p><a href="#TABLE3">Table 3</a> summarizes the options supported by the <code>lpd</code> backend.</p>
163*5e7646d2SAndroid Build Coastguard Worker
164*5e7646d2SAndroid Build Coastguard Worker    <blockquote><b>Note:</b> Due to limitations in the LPD protocol, we do not recommend using it if the printer or server supports any of the other protocols. Like AppSocket, LPD offers no security and is a common attack vector. LPD also, by default, requires that the computer save a copy of the entire print job before sending it to the printer - this can result in gigabytes of print data being saved to disk before any printing happens, delaying print jobs and shortening the life of your mass storage device!</blockquote>
165*5e7646d2SAndroid Build Coastguard Worker
166*5e7646d2SAndroid Build Coastguard Worker    <div class="table"><table summary="LPD URI Options">
167*5e7646d2SAndroid Build Coastguard Worker      <caption>Table 3: <A NAME="TABLE3">LPD URI Options</a></caption>
168*5e7646d2SAndroid Build Coastguard Worker      <thead>
169*5e7646d2SAndroid Build Coastguard Worker	<tr>
170*5e7646d2SAndroid Build Coastguard Worker	  <th>Option</th>
171*5e7646d2SAndroid Build Coastguard Worker	  <th>Description</th>
172*5e7646d2SAndroid Build Coastguard Worker	</tr>
173*5e7646d2SAndroid Build Coastguard Worker      </thead>
174*5e7646d2SAndroid Build Coastguard Worker      <tbody>
175*5e7646d2SAndroid Build Coastguard Worker	<tr>
176*5e7646d2SAndroid Build Coastguard Worker	  <td><code>banner=on</code></td>
177*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that a banner page should be printed by the printer.</td>
178*5e7646d2SAndroid Build Coastguard Worker	</tr>
179*5e7646d2SAndroid Build Coastguard Worker	<tr>
180*5e7646d2SAndroid Build Coastguard Worker	  <td><code>contimeout=<I>seconds</I></code></td>
181*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies the number of seconds to wait for the connection to the printer to complete (default 1 week or 604800 seconds).</td>
182*5e7646d2SAndroid Build Coastguard Worker	</tr>
183*5e7646d2SAndroid Build Coastguard Worker	<tr>
184*5e7646d2SAndroid Build Coastguard Worker	  <td><code>format=f</code></td>
185*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the print data is a plain text file.</td>
186*5e7646d2SAndroid Build Coastguard Worker	</tr>
187*5e7646d2SAndroid Build Coastguard Worker	<tr>
188*5e7646d2SAndroid Build Coastguard Worker	  <td><code>format=o</code></td>
189*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the print data is a PostScript file.</td>
190*5e7646d2SAndroid Build Coastguard Worker	</tr>
191*5e7646d2SAndroid Build Coastguard Worker	<tr>
192*5e7646d2SAndroid Build Coastguard Worker	  <td><code>format=p</code></td>
193*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the print data is a plain text file that should be "pretty" printed with a header and footer.</td>
194*5e7646d2SAndroid Build Coastguard Worker	</tr>
195*5e7646d2SAndroid Build Coastguard Worker	<tr>
196*5e7646d2SAndroid Build Coastguard Worker	  <td><code>mode=stream</code></td>
197*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the backend should stream print data to the printer and not wait for confirmation that the job has been successfully printed.</td>
198*5e7646d2SAndroid Build Coastguard Worker	</tr>
199*5e7646d2SAndroid Build Coastguard Worker	<tr>
200*5e7646d2SAndroid Build Coastguard Worker	  <td><code>order=data,control</code></td>
201*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the print data files should be sent before the control file.</td>
202*5e7646d2SAndroid Build Coastguard Worker	</tr>
203*5e7646d2SAndroid Build Coastguard Worker	<tr>
204*5e7646d2SAndroid Build Coastguard Worker	  <td><code>reserve=none</code></td>
205*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the backend should not reserve a source port.</td>
206*5e7646d2SAndroid Build Coastguard Worker	</tr>
207*5e7646d2SAndroid Build Coastguard Worker	<tr>
208*5e7646d2SAndroid Build Coastguard Worker	  <td><code>reserve=rfc1179</code></td>
209*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the backend should reserve a source port from 721 to 731 as required by RFC 1179.</td>
210*5e7646d2SAndroid Build Coastguard Worker	</tr>
211*5e7646d2SAndroid Build Coastguard Worker	<tr>
212*5e7646d2SAndroid Build Coastguard Worker	  <td><code>sanitize_title=no</code></td>
213*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the job title string should not be restricted to ASCII alphanumeric and space characters.</td>
214*5e7646d2SAndroid Build Coastguard Worker	</tr>
215*5e7646d2SAndroid Build Coastguard Worker	<tr>
216*5e7646d2SAndroid Build Coastguard Worker	  <td><code>sanitize_title=yes</code></td>
217*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies that the job title string should be restricted to ASCII alphanumeric and space characters.</td>
218*5e7646d2SAndroid Build Coastguard Worker	</tr>
219*5e7646d2SAndroid Build Coastguard Worker	<tr>
220*5e7646d2SAndroid Build Coastguard Worker	  <td><code>timeout=<I>seconds</I></code></td>
221*5e7646d2SAndroid Build Coastguard Worker	  <td>Specifies the number of seconds to wait for LPD commands to complete (default 5 minutes or 300 seconds).</td>
222*5e7646d2SAndroid Build Coastguard Worker	</tr>
223*5e7646d2SAndroid Build Coastguard Worker      </tbody>
224*5e7646d2SAndroid Build Coastguard Worker    </table></div>
225*5e7646d2SAndroid Build Coastguard Worker
226*5e7646d2SAndroid Build Coastguard Worker
227*5e7646d2SAndroid Build Coastguard Worker    <h2 class="title" id="SNMP">Finding Printers Using SNMP</h2>
228*5e7646d2SAndroid Build Coastguard Worker
229*5e7646d2SAndroid Build Coastguard Worker    <p>Whenever you view the administration web page or a list of supported device URIs, the <code>snmp</code> backend can probe the local network(s) using Simple Network Management Protocol (SNMP) v1 broadcasts. Printers that respond to these broadcasts are then interrogated for the make, model, and supported protocols, yielding a device URI that can be used to add the printer.</p>
230*5e7646d2SAndroid Build Coastguard Worker
231*5e7646d2SAndroid Build Coastguard Worker    <p>The <a href="man-cups-snmp.conf.html"><var>/etc/cups/snmp.conf</var></a> file configures the <code>snmp</code> backend. Add the following line to enable discovery using the <code>snmp</code> backend:</p>
232*5e7646d2SAndroid Build Coastguard Worker
233*5e7646d2SAndroid Build Coastguard Worker    <pre class="example">Address @LOCAL</pre>
234*5e7646d2SAndroid Build Coastguard Worker
235*5e7646d2SAndroid Build Coastguard Worker    <p>If you don't use "public" as your community name, change the <code>Community</code> line as well:</p>
236*5e7646d2SAndroid Build Coastguard Worker
237*5e7646d2SAndroid Build Coastguard Worker    <pre class="example">Community <I>your community name</I></pre>
238*5e7646d2SAndroid Build Coastguard Worker
239*5e7646d2SAndroid Build Coastguard Worker    <blockquote><b>Note:</b> The <code>snmp</code> backend will not be able to find any printers on your network if SNMP v1 or broadcasting are disabled on your network. Also, broadcasts are typically limited to the local subnet, so printers on different networks cannot be discovered using SNMP.</blockquote>
240*5e7646d2SAndroid Build Coastguard Worker
241*5e7646d2SAndroid Build Coastguard Worker    <h3>Troubleshooting SNMP Problems</h3>
242*5e7646d2SAndroid Build Coastguard Worker
243*5e7646d2SAndroid Build Coastguard Worker    <p>The <code>snmp</code> backend sometimes exposes problems in vendor implementations. If you are experiencing long delays in loading the CUPS web interface administration page, or if you don't see your printer listed, the following instructions will help you to diagnose those problems and/or provide important feedback to the CUPS developers so that we can correct problems and improve the <code>snmp</code> backend in future releases.</p>
244*5e7646d2SAndroid Build Coastguard Worker
245*5e7646d2SAndroid Build Coastguard Worker    <p>The SNMP backend supports a debugging mode that is activated by running it from a shell prompt. Run the following command to get a verbose log of the <code>snmp</code> backend:</p>
246*5e7646d2SAndroid Build Coastguard Worker
247*5e7646d2SAndroid Build Coastguard Worker    <pre class="command">CUPS_DEBUG_LEVEL=2 /usr/lib/cups/backend/snmp @LOCAL 2>&amp;1 | tee snmp.log</pre>
248*5e7646d2SAndroid Build Coastguard Worker
249*5e7646d2SAndroid Build Coastguard Worker    <p>On macOS you'll find the backend in /usr/libexec/cups/backend instead:</p>
250*5e7646d2SAndroid Build Coastguard Worker
251*5e7646d2SAndroid Build Coastguard Worker    <pre class="command">CUPS_DEBUG_LEVEL=2 /usr/libexec/cups/backend/snmp @LOCAL 2>&amp;1 | tee snmp.log</pre>
252*5e7646d2SAndroid Build Coastguard Worker
253*5e7646d2SAndroid Build Coastguard Worker    <p>The output will look something like this:</p>
254*5e7646d2SAndroid Build Coastguard Worker
255*5e7646d2SAndroid Build Coastguard Worker    <pre class="example"> 1  INFO: Using default SNMP Address @LOCAL
256*5e7646d2SAndroid Build Coastguard Worker 2  INFO: Using default SNMP Community public
257*5e7646d2SAndroid Build Coastguard Worker 3  DEBUG: Scanning for devices in "public" via "@LOCAL"...
258*5e7646d2SAndroid Build Coastguard Worker 4  DEBUG: 0.000 Sending 46 bytes to 10.0.1.255...
259*5e7646d2SAndroid Build Coastguard Worker 5  DEBUG: SEQUENCE 44 bytes
260*5e7646d2SAndroid Build Coastguard Worker 6  DEBUG:     INTEGER 1 bytes 0
261*5e7646d2SAndroid Build Coastguard Worker 7  DEBUG:     OCTET STRING 6 bytes "public"
262*5e7646d2SAndroid Build Coastguard Worker 8  DEBUG:     Get-Request-PDU 31 bytes
263*5e7646d2SAndroid Build Coastguard Worker 9  DEBUG:         INTEGER 4 bytes 1149539174
264*5e7646d2SAndroid Build Coastguard Worker10  DEBUG:         INTEGER 1 bytes 0
265*5e7646d2SAndroid Build Coastguard Worker11  DEBUG:         INTEGER 1 bytes 0
266*5e7646d2SAndroid Build Coastguard Worker12  DEBUG:         SEQUENCE 17 bytes
267*5e7646d2SAndroid Build Coastguard Worker13  DEBUG:             SEQUENCE 15 bytes
268*5e7646d2SAndroid Build Coastguard Worker14  DEBUG:                 OID 11 bytes .1.3.6.1.2.1.25.3.2.1.2.1
269*5e7646d2SAndroid Build Coastguard Worker15  DEBUG:                 NULL VALUE 0 bytes
270*5e7646d2SAndroid Build Coastguard Worker16  DEBUG: 0.001 Received 55 bytes from 10.0.1.42...
271*5e7646d2SAndroid Build Coastguard Worker17  DEBUG: community="public"
272*5e7646d2SAndroid Build Coastguard Worker18  DEBUG: request-id=1149539174
273*5e7646d2SAndroid Build Coastguard Worker19  DEBUG: error-status=0
274*5e7646d2SAndroid Build Coastguard Worker20  DEBUG: SEQUENCE 53 bytes
275*5e7646d2SAndroid Build Coastguard Worker21  DEBUG:     INTEGER 1 bytes 0
276*5e7646d2SAndroid Build Coastguard Worker22  DEBUG:     OCTET STRING 6 bytes "public"
277*5e7646d2SAndroid Build Coastguard Worker23  DEBUG:     Get-Response-PDU 40 bytes
278*5e7646d2SAndroid Build Coastguard Worker24  DEBUG:         INTEGER 4 bytes 1149539174
279*5e7646d2SAndroid Build Coastguard Worker25  DEBUG:         INTEGER 1 bytes 0
280*5e7646d2SAndroid Build Coastguard Worker26  DEBUG:         INTEGER 1 bytes 0
281*5e7646d2SAndroid Build Coastguard Worker27  DEBUG:         SEQUENCE 26 bytes
282*5e7646d2SAndroid Build Coastguard Worker28  DEBUG:             SEQUENCE 24 bytes
283*5e7646d2SAndroid Build Coastguard Worker29  DEBUG:                 OID 11 bytes .1.3.6.1.2.1.25.3.2.1.2.1
284*5e7646d2SAndroid Build Coastguard Worker30  DEBUG:                 OID 9 bytes .1.3.6.1.2.1.25.3.1.5
285*5e7646d2SAndroid Build Coastguard Worker31  DEBUG: add_cache(addr=0xbfffe170, addrname="10.0.1.42", uri="(null)", id="(null)", make_and_model="(null)")
286*5e7646d2SAndroid Build Coastguard Worker32  DEBUG: 0.002 Sending 46 bytes to 10.0.1.42...
287*5e7646d2SAndroid Build Coastguard Worker33  DEBUG: SEQUENCE 44 bytes
288*5e7646d2SAndroid Build Coastguard Worker34  DEBUG:     INTEGER 1 bytes 0
289*5e7646d2SAndroid Build Coastguard Worker35  DEBUG:     OCTET STRING 6 bytes "public"
290*5e7646d2SAndroid Build Coastguard Worker36  DEBUG:     Get-Request-PDU 31 bytes
291*5e7646d2SAndroid Build Coastguard Worker37  DEBUG:         INTEGER 4 bytes 1149539175
292*5e7646d2SAndroid Build Coastguard Worker38  DEBUG:         INTEGER 1 bytes 0
293*5e7646d2SAndroid Build Coastguard Worker39  DEBUG:         INTEGER 1 bytes 0
294*5e7646d2SAndroid Build Coastguard Worker40  DEBUG:         SEQUENCE 17 bytes
295*5e7646d2SAndroid Build Coastguard Worker41  DEBUG:             SEQUENCE 15 bytes
296*5e7646d2SAndroid Build Coastguard Worker42  DEBUG:                 OID 11 bytes .1.3.6.1.2.1.25.3.2.1.3.1
297*5e7646d2SAndroid Build Coastguard Worker43  DEBUG:                 NULL VALUE 0 bytes
298*5e7646d2SAndroid Build Coastguard Worker44  DEBUG: 0.003 Received 69 bytes from 10.0.1.42...
299*5e7646d2SAndroid Build Coastguard Worker45  DEBUG: community="public"
300*5e7646d2SAndroid Build Coastguard Worker46  DEBUG: request-id=1149539175
301*5e7646d2SAndroid Build Coastguard Worker47  DEBUG: error-status=0
302*5e7646d2SAndroid Build Coastguard Worker48  DEBUG: SEQUENCE 67 bytes
303*5e7646d2SAndroid Build Coastguard Worker49  DEBUG:     INTEGER 1 bytes 0
304*5e7646d2SAndroid Build Coastguard Worker50  DEBUG:     OCTET STRING 6 bytes "public"
305*5e7646d2SAndroid Build Coastguard Worker51  DEBUG:     Get-Response-PDU 54 bytes
306*5e7646d2SAndroid Build Coastguard Worker52  DEBUG:         INTEGER 4 bytes 1149539175
307*5e7646d2SAndroid Build Coastguard Worker53  DEBUG:         INTEGER 1 bytes 0
308*5e7646d2SAndroid Build Coastguard Worker54  DEBUG:         INTEGER 1 bytes 0
309*5e7646d2SAndroid Build Coastguard Worker55  DEBUG:         SEQUENCE 40 bytes
310*5e7646d2SAndroid Build Coastguard Worker56  DEBUG:             SEQUENCE 38 bytes
311*5e7646d2SAndroid Build Coastguard Worker57  DEBUG:                 OID 11 bytes .1.3.6.1.2.1.25.3.2.1.3.1
312*5e7646d2SAndroid Build Coastguard Worker58  DEBUG:                 OCTET STRING 23 bytes "HP LaserJet 4000 Series"
313*5e7646d2SAndroid Build Coastguard Worker59  DEBUG: 1.001 Probing 10.0.1.42...
314*5e7646d2SAndroid Build Coastguard Worker60  DEBUG: 1.001 Trying socket://10.0.1.42:9100...
315*5e7646d2SAndroid Build Coastguard Worker61  DEBUG: 10.0.1.42 supports AppSocket!
316*5e7646d2SAndroid Build Coastguard Worker62  DEBUG: 1.002 Scan complete!
317*5e7646d2SAndroid Build Coastguard Worker63  network socket://10.0.1.42 "HP LaserJet 4000 Series" "HP LaserJet 4000 Series 10.0.1.42" ""</pre>
318*5e7646d2SAndroid Build Coastguard Worker
319*5e7646d2SAndroid Build Coastguard Worker    <p>The first two lines are just informational and let you know that the default community name and address are being used. Lines 3-15 contain the initial SNMP query for the device type OID (.1.3.6.1.2.1.25.3.2.1.2.1) from the Host MIB.</p>
320*5e7646d2SAndroid Build Coastguard Worker
321*5e7646d2SAndroid Build Coastguard Worker    <p>Lines 16-31 show the response we got from an HP LaserJet 4000 network printer. At this point we discover that it is a printer device and then send another SNMP query (lines 32-43) for the device description OID (.1.3.6.1.2.1.25.3.2.1.3.1) from the Host MIB as well.</p>
322*5e7646d2SAndroid Build Coastguard Worker
323*5e7646d2SAndroid Build Coastguard Worker    <p>Lines 44-58 show the response to the device description query, which tells us that this is an HP LaserJet 4000 Series printer.</p>
324*5e7646d2SAndroid Build Coastguard Worker
325*5e7646d2SAndroid Build Coastguard Worker    <p>On line 59 we start our active connection probe and discover that this print server supports the AppSocket (JetDirect) protocol on port 9100.</p>
326*5e7646d2SAndroid Build Coastguard Worker
327*5e7646d2SAndroid Build Coastguard Worker    <p>Finally, line 63 shows the device information line for the print server that is sent to CUPS.</p>
328*5e7646d2SAndroid Build Coastguard Worker
329*5e7646d2SAndroid Build Coastguard Worker    <p>If you don't see your printer listed, or the wrong information is listed, then you need to gather more information on the printer. The easiest way to do this is to run the snmpwalk command:</p>
330*5e7646d2SAndroid Build Coastguard Worker
331*5e7646d2SAndroid Build Coastguard Worker    <pre class="command">snmpwalk -Cc -v 1 -c public ip-address | tee snmpwalk.log</pre>
332*5e7646d2SAndroid Build Coastguard Worker
333*5e7646d2SAndroid Build Coastguard Worker    <p>where "ip-address" is the IP address of the printer or print server. You should see a <em>lot</em> of values stream by - the ones you want to see are:</p>
334*5e7646d2SAndroid Build Coastguard Worker
335*5e7646d2SAndroid Build Coastguard Worker    <pre class="example">HOST-RESOURCES-MIB::hrDeviceType.1 = OID: HOST-RESOURCES-TYPES::hrDevicePrinter
336*5e7646d2SAndroid Build Coastguard WorkerHOST-RESOURCES-MIB::hrDeviceDescr.1 = STRING: HP LaserJet 4000 Series</pre>
337*5e7646d2SAndroid Build Coastguard Worker
338*5e7646d2SAndroid Build Coastguard Worker    <p>The hrDeviceType line should show hrDevicePrinter; if not, then your printer or print server doesn't identify itself as a printer. The hrDeviceDescr line should provide a human-readable string for the make and model of the printer, although in some cases you'll just see something less useful like "Axis OfficeBASIC Parallel Print Server".</p>
339*5e7646d2SAndroid Build Coastguard Worker
340*5e7646d2SAndroid Build Coastguard Worker    <p>Once you have collected the snmpwalk output, you should go to the  <a href="https://github.com/apple/cups/issues">CUPS Issue Tracker</a> page to submit a feature request to support your printer or print server. Be sure to attach those two log files you created - they will help us to identify the SNMP values we need to look for.</p>
341*5e7646d2SAndroid Build Coastguard Worker  </body>
342*5e7646d2SAndroid Build Coastguard Worker</html>
343