Implementing a satellite avahi listener / responder to advertise iPrint printers

  • 7015852
  • 30-Oct-2014
  • 18-Apr-2018

Environment

iPrint Appliance 1.x
Note: this document does not apply to iPrint Appliance 2.x or 3.x
Avahi

Situation

When attempting to print from an App which searches for printers using AirPrint, the message "No AirPrint Printers Found" is returned.

iOS Apps which use AirPrint are:
  • Camera
  • Notes
  • Mail
  • Safari
  • Chrome
  • Dropbox
Note 1: Not all apps are listed.
Note 2: The following iOS Apps are known to work with the Novell iPrint App:
  • Adobe Reader
  • Attachments in Mail app (except for photos)
The error message cited above appears even though the AirPrint option is enabled for one or more printers through the iPrint Appliance Management Console.

As described previously in TID# 7012895, the default multi-cast DNS advertisement of iPrint printer fails in multi-segmented networks. Another possible solution to this issue is to setup a satellite Avahi server to perform the advertisement. This differs from an Avahi reflector wherein the multi-casts do not traverse / reflect on the separate networks. The Avahi satellite simply receives all requests on the network segment it is listening on and responds accordingly with the appropriate services as advertised by the iPrint appliance.

On the iPrint appliance (after enabling Avahi advertisement for a particular printer) a service file is created for that particular printer in the /etc/avahi/services directory. Each file will be in the format of <printername>.service. These files can be copied (or rsync'd) over to any number of satellite servers.


Resolution

Click here to watch a video demonstrating how the Avahi listener solution works.  Note, the same video also demonstrates the DNS-SD solution.

To setup a satellite Avahi server, perform the following:

1. Enable iPrint Printers for AirPrint
Go to the iPrint Appliance Management Console:
https://<IP or DNS>:9443
Choose "iPrint Appliance Configuration"
Choose "Printers" (left frame)
Ensure the printer (or printers) is enabled for Mobile and AirPrint.

2. Connect any Linux system to the wireless network. This may be done via a wireless interface, or connected on the same network / VLAN that the wireless network uplinks to down the line.
3. Ensure the Avahi package is installed
rpm -qa |grep avahi
4. Copy the printer service files from the iPrint appliance server's /etc/avahi/services directory to the satellite Avahi server.
5. Restart the Avahi daemon on the satellite server
SuSE based Linux distributions:
rcavahi-daemon restart
Ubuntu based Linux distributions
sudo service avahi-daemon restart
Other Linux distributions
Refer to their documentation
The printers are now advertised on the network where the Avahi satellite server is attached. Please note that this process can be repeated as necessary as new printers are added. If a printer is removed, make sure to remove the service file from the satellite servers as well.

A more elegant solution would be to rsync the contents of /etc/avahi/services to each satellite server on a regular interval to ensure that all systems stay in sync.

A less elegant solution, but workable solution, to automate the copying of service files from the iPrint Appliance to the satellite Avahi listener machine is to use cron.  You can configure cron to copy the service files at whatever interval (minute, day, week, etc) you desire.  The steps to set this up are:

Within a terminal session (putty or otherwise):
  1. Execute the ssh keygen command
    • ssh-keygen -t rsa
      • Hit ENTER three times
  2. Execute the ssh copy id command
    • Syntax:
      • ssh-copy-id root@<IP address of satellite Linux machine>
    • Example:
      • ssh-copy-id root@172.16.3.9
    • You may need to type 'yes' and hit ENTER (if prompted)
    • Enter the root password of the satellite Linux machine
  3. Add the following line to the /etc/crontab file on the iPrint Appliance
    • Syntax:
      • */10 * * * * root scp /etc/avahi/services/* root@<IP address of satellite Linux machine>:/etc/avahi/services/
    • Example:
      • */10 * * * * root scp /etc/avahi/services/* root@172.16.3.9:/etc/avahi/services/
        • The update interval can be as frequent as you like.  The above example copies the Avahi service files every 10 minutes. 
  4. Restart cron
    • rccron restart

Additional Information

This solution will not increase traffic on your network in the same way an Avahi reflector or forwarding multicast frames would. The satellite server will simply respond to queries as they come in as if the actual iPrint appliance server was sitting on that wireless network.

As a Proof Of Concept, you can see this technology work by getting this to work with a laptop with a wireless card and booting from a bootable Ubuntu DVD.

  1. Download the Ubuntu Live cd
    • http://www.ubuntu.com/download/desktop/thank-you?country=US&version=14.04&architecture=amd64
  2. Burn the Ubuntu ISO image to a DVD
    • Note: Do not burn the ISO file to a DVD, but instead burn the IMAGE to DVD.
      • Insert a recordable DVD into your disc drive.
      • In Windows Explorer, right-click the downloaded Ubuntu ISO file, choose "Open with" -> "Windwos Disc Image Burner". Choose the drive which has the blank DVD, and click "Burn"
  3. Boot into Ubuntu OS
    • Power off the laptop
    • Insert the Ubuntu Live cd/dvd
    • Power on the laptop
    • Hit the Function Key which gives the option to boot from CD/DVD.
      • Different manufacturers use different keys; F2 is fairly common, but it may also be Delete, F1, F10, F12, etc.
      • You have a short window of time to hit the correct Function Key.
      • This will NOT erase or touch your currently installed OS.
    • Click the "Try Ubuntu" button
    • Do NOT choose "Install Ubuntu", as that will overwrite your current OS.
  4. Connect to the same wireless network which the iOS device connects.
  5. Copy the Avahi service files to the Ubuntu laptop
    • Open a terminal session:
      • ctrl + alt + t will accomplish this task.
    • Execute the following commands within the terminal session:
      • sudo scp root@<ip of iPrint Appliance server>:/etc/avahi/services/* /etc/avahi/services/
      • sudo service avahi-daemon restart
  6. Test to see if the printers show from the iOS device.
Troubleshooting
If the printers are not found, follow these troubleshooting steps:
  1. Ensure the following network requirements are be met
    • The IP group address of 224.0.0.251 over UDP port 5353 is forwarded throughout the wireless subnet. 
    • You do NOT need to allow this multicast traffic across subnets.
  2. The iOS device must be able to discover the Bonjour (Avahi) advertised printers on the same wireless network.
    • From the App store
    • download and install the Discovery - Bonjour Browser. 
    • Choose the "IPP (Internet Printing Protocol)" service. 
    • Do you see the Bonjour (Avahi) advertised printers? 
  3. Ping the Ubuntu laptop from the iOS device
    • Download and install "Free Ping" from the App store.
    • Can you ping the Ubuntu laptop's IP address?
      • To find the IP address of the Ubuntu laptop:
        • sudo ifconfig
  4. Can TCP packets find each other between the iOS device and the Ubuntu laptop?
    • Install the SSH Daemon to the Ubuntu laptop
      • sudo apt-get install openssh-server
    • Download and install "Fing" from the App store.
      • Tap the Ubuntu laptop's IP address in the list of discovered devices on that subnet.
      • Swip up and choose "Scan services"
      • Does 22 SSH show up?
Note: While Ping and finding SSH are helpful network troubleshooting tools, ultimately, UDP port 5353 is what needs to be open between the iOS device and Ubuntu laptop.