From Electron Cloud
Jump to: navigation, search
(OpenWRT)
(CUPS printers)
Line 40: Line 40:
  
 
I figured out how based on [http://burtonini.com/blog/computers/avahi-epiphany-2006-02-11-17-50 this] and [http://developer.apple.com/networking/bonjour/BonjourPrinting.pdf the spec].
 
I figured out how based on [http://burtonini.com/blog/computers/avahi-epiphany-2006-02-11-17-50 this] and [http://developer.apple.com/networking/bonjour/BonjourPrinting.pdf the spec].
 +
 +
When I use the wizard on Windows, the result is that it adds a printer using the "Internet Port" http://muon.local:631/printers/LaserWriter-raw.  One feature I would like to have, is if I rename the server, or I move the printer from one server to another, it should still be found.  Unfortunately Windows has to have the hostname, so I'm not sure how to achieve this result.  Windows probably ought to be doing the service discovery each time you print, and finding the service of the same name as configured, rather than looking for the hostname.  One way I solved it with regular DNS (running bind on one of my servers) is to create a CNAME pointing printer.lan to the actual server, so if I move the printer I just change the CNAME mapping.  I have not figured out how to do that with mDNS.

Revision as of 12:33, 18 March 2007

An mDNS "responder" is a daemon which runs on a device, and when it sees a multicast message of the form "where is Elvira.local?" it responds with the IP address, assuming that machine on which the responder is running is named Elvira. Usually each machine can only answer for itself; machines which do not have the authoritative answer will not reply. Sort of like a roll call in a class... But not every device has a responder available for it, so using avahi, you can add the name/address mappings for such machines in /etc/avahi/hosts.

There is also the concept of an mDNS "reflector" whose job apparently is to act as a gateway between two or more networks, causing queries and replies on one network to also be sent out on the other network.

mDNS can also be used to find services; this feature is called dnssd (DNS service discovery).

On Gentoo the choices are avahi and mDNSResponder. avahi is more full-featured and includes client programs like avahi-discover (to find devices and services on the network) and avahi-publish (a daemon which announces a service or a device, on behalf of one that cannot announce it itself).

OpenWRT

It would appear that the mDNSResponder on OpenWRT acts as a reflector (?); what I observe is that queries from WiFi can be answered by machines on the LAN. Or it could be that this behavior is caused by iptables rules rather than the responder itself.

CUPS printers

Bonjour for Windows includes a Bonjour Printer Wizard which can find Bonjour-enabled printers on the network and automatically install them in the Printers control panel. I would hope that some day CUPS would register printers automatically, but for now it seems not to. I run avahi on my CUPS server; so announcing the printer was just a matter of creating a file /etc/avahi/services/laserwriter.service, like this:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name>LaserWriter</name>
  <service>
    <type>_ipp._tcp</type>
    <port>631</port>
    <txt-record>path=/printers/LaserWriter</txt-record>
    <txt-record>rp=printers/LaserWriter</txt-record>
    <txt-record>note=Multimedia Room</txt-record>
        <txt-record>qtotal=1</txt-record>
        <txt-record>ty=Apple LaserWriter 600</txt-record>
        <txt-record>>adminurl=http://muon:631/printers/LaserWriter</txt-record>
        <txt-record>Color=F</txt-record>
        <txt-record>Duplex=F</txt-record>
        <txt-record>Bind=F</txt-record>
        <txt-record>Collate=F</txt-record>
        <txt-record>Sort=F</txt-record>
        <txt-record>Staple=F</txt-record>
        <txt-record>Punch=F</txt-record>
        <txt-record>PaperMax=legal-A4</txt-record>
  </service>
</service-group>

I figured out how based on this and the spec.

When I use the wizard on Windows, the result is that it adds a printer using the "Internet Port" http://muon.local:631/printers/LaserWriter-raw. One feature I would like to have, is if I rename the server, or I move the printer from one server to another, it should still be found. Unfortunately Windows has to have the hostname, so I'm not sure how to achieve this result. Windows probably ought to be doing the service discovery each time you print, and finding the service of the same name as configured, rather than looking for the hostname. One way I solved it with regular DNS (running bind on one of my servers) is to create a CNAME pointing printer.lan to the actual server, so if I move the printer I just change the CNAME mapping. I have not figured out how to do that with mDNS.