.NODE

LPD Printer Support

Problem

You want to connect a printer to your router to use from the Berkeley Unix LPD print program.

Solution

You can connect a printer to any asynchronous interface on a router. This typically means your AUX port, but as we discussed in Recipe 16.6, there are several other options for asynchronous serial ports on routers:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#printer rtlpr1 line 161
Router1(config)#end
Router1# 

 

Discussion

The Berkeley Unix Line Printer Daemon (LPD) protocol is defined in RFC 1179. It is a relatively simple TCP protocol in which a device supporting a printer listens on TCP port 515 for inbound connections and accepts commands to do things like print a file or delete a job from the queue.

There are several prerequisites to making this deceptively simple recipe work properly. First, you must have a computer that supports the Berkeley Unix LPD print program. Second, you must correctly configure the /etc/printcap file on this computer so that it will spool print jobs to the router. Third, you must have a printer that can take a serial input instead of the more customary parallel or USB connections. And fourth, you have to figure out the line number associated with this printer connection.

We assume you have the first point under control. Any standard Linux or FreeBSD system, as well as any commercial Unix implementation such as Solaris, HPUX, or AIX, will definitely have LPD support. Microsoft has also included LPD support in Windows XP. Please refer to this Microsoft web page (http://support.microsoft.com/kb/324078/en-us) for an excellent detailed step-by-step guide to configuring LPD print services on a Windows XP system.

For the second point, this depends somewhat on your system. The standard Berkeley printcap file format has many options, and we strongly recommend that you refer to your local documentation to determine the best settings. However, here is a simple example printcap entry for use with a printer connected to a router:

routerptr1|Printer connected to office WAN router:
 :rm=router1:
 :rp=rtlpr1:
 :if=/usr/local/libexec/lpfilter:
 :sd=/usr/spool/lpd/router1ptr:
 :lf=/var/log/lpd-errs:

In this example, there are two key lines and a few others that you may need to play with. The printcap file format includes a list of variables that are generically called "capabilities," separated by colons ":". The "rm" capability defines the "remote machine," in this case the router, router1. Note that you must have this hostname defined either in DNS or on the hosts file on the local system.

Next is the "rp" capability, which lists the printer by the name by which it is known on the remote system. In our example, the printer command on the router defined the printer to be called rtlpr1, so that is the string that we must use here.

The remaining entries define filters, spool directories, and the location of the error file, where details of any problems printing to this device will be recorded.

Finally, getting back to the configuration of the router itself, we have to be careful about specifying the line number of the asynchronous serial port that connects to the printer. In this case, we are using the AUX port on the router. So we have to use the show line command to determine the line number associated with this port:

Router1#show line
 Tty Typ Tx/Rx A Modem Roty AccO AccI Uses Noise Overruns Int
 0 CTY - - - - - 0 0 0/0 -
 161 AUX 9600/9600 - - - - - 0 0 0/0 -
* 162 VTY - - - - - 8 0 0/0 -
 163 VTY - - - - - 1 0 0/0 -
 164 VTY - - - - - 1 0 0/0 -
 165 VTY - - - - - 0 0 0/0 -
 166 VTY - - - - - 0 0 0/0 -
 167 VTY - - 25 - 9 0 0 0/0 -
 168 VTY - - 25 - 9 0 0 0/0 -
 169 VTY - - 25 - 9 0 0 0/0 -

Line(s) not in async mode -or- with no hardware support:
1-160

Router1#

In this case, you can see that the AUX port is line number 161. So this is the value that we must use in the printer command:

Router1(config)#printer rtlpr1 line 161

You will also notice that this line is configured with the default baud rate of 9600. It may be useful to alter the default settings. In particular, we recommend disabling logins on this interface. Otherwise a random bit of electrical noise from the printer might be interpreted as a carriage return by the router, which will respond by putting up a login prompt. The printer will then print this prompt, causing great annoyance and waste of paper:

Router1(config)#line aux 0
Router1(config-line)#no exec
Router1(config-line)#no login
Router1(config-line)#no password
Router1(config-line)#transport input none
Router1(config-line)#speed 115200
Router1(config-line)#exit

In this example, we have somewhat arbitrarily set the baud rate to 115,200 bps. You should use the maximum speed your printer will reliably support.

To look at the status of a printer on the router, use the show printer command:

Router1#show printer
Printer Line Rotary Errors Connections Datafiles Controlfiles Bytes
rtlpr1 161 0 0 0 0 0 0 
Router1#

 

See Also

Recipe 16.6; RFC 1179

Router Configuration and File Management

Router Management

User Access and Privilege Levels

TACACS+

IP Routing

RIP

EIGRP

OSPF

BGP

Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time

DLSw

Router Interfaces and Media

Simple Network Management Protocol

Logging

Access-Lists

DHCP

NAT

First Hop Redundancy Protocols

IP Multicast

IP Mobility

IPv6

MPLS

Security

Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications

Index

show all menu





Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net