Subject: Re: lpd and dhcpd = problems
To: Peter Bex <Peter.Bex@student.ru.nl>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: netbsd-users
Date: 11/03/2005 17:47:29
In message <20051103220257.GC7571@frohike.nvie.com>, Peter Bex writes:
>

>
>My server runs dhcpd and lpd.  Printing works from a (NetBSD) desktop with
>a static IP and matching line in /etc/hosts.
>
>Now I would like to print from a (OS X) laptop with dynamic IP to the
>server.  I don't get an error or output, and when I post my first job, lpq
>tells me that the printer is not ready.  When I telnet to port 515 from the
>laptop, I get the following error:
>/usr/sbin/lpd: Host name for your address (192.168.0.64) unknown
>
>After a bit of googling, I found out that lpd requires a reverse DNS lookup
>to resolve correctly before it will allow a host to print.  (this is not
>documented in the lpd manpage)  And indeed, assigning a static IP to the
>machine with a hostname in /etc/hosts fixes the problem.
>
>Is there a way to make lpd and dhcpd play nice together so arbitrary hosts
>can be added to the network and allowed to print?  (WITHOUT installing CUPS
>or LPRng)
>
>Why does it require a DNS lookup to work correctly?  It would appear to me
>that this could rather easily be spoofed anyway.
>

The short answer is "brain damage"; lpr want to check hostnames against
/etc/hosts.lpd.  The easiest thing to do is to create the dns entry or 
-- if it's something like a RFC 1918 address -- put it in /etc/hosts.  
Then configure dhcpd to have a quasi-static address for the Mac.  Or 
set up a pile of dynamic addresses with hostnames in /etc/hosts.

Not that installing CUPS is that bad an idea, but you've ruled it out...

		--Steven M. Bellovin, http://www.cs.columbia.edu/~smb