An annoying feature of recent iOS is the AirPrint capability! I'm saying that is annoying because you can print from your iOS device only to enabled printers. Today this feature is added to lot of printers, but maybe (like in my situation) means: change my printer with a new one.

Considering that I'm using printer just in rare situations (like print online flying tickets) is not reasonable to change it! So, looking on internet, I found that you can easily create an AirPrint printer server using a native application for MacOSX/Windows or, if you have a linux home server like me, the avahi service included in linux distributions.

To configure your avahi service with your printer you can use this python script: https://github.com/tjfontaine/airprint-generate with this simple command

python airprint-generate.py

that will automatically look in your linux cups configuration, extract your printer and generate the file for avahi. If you have more than one printer configure you can pass a parameter to the script saying witch printer you want to configure.

If all works well you should have a file with a name like this: AirPrint-EPSONDX5000.service containing all required information.
Now, just copying this file in the avahi service folder, you will enable your printer:

mv AirPrint-EPSONDX5000.service /etc/avahi/services/AirPrint-EPSONDX5000.service

If all works well you should have this on your iOS device:


NOTE: I noticed with some avahi version there is problem discovering printers: printer is shown in your iOS device just for a couple of minute and then you cannot see it anymore. To fix this problem I just added in crontab (run every minute):

touch /etc/avahi/services/AirPrint-EPSONDX5000.service

I know that is not a really cool solution, but I didn't found anything better. Actually on my Fedora the problem with amahi seems fixed, but "remember the touch" if you have problems ;)

UPDATE:
Following the matt suggestion in the comments, you can edit your iptables firewall rules allowing multicast DNS traffic (mDNS).
For example add in your /etc/sysconfig/iptables file, this line

-A RH-Firewall-1-INPUT -p udp --dport 5353 -d 224.0.0.251 -j ACCEPT

Using anĀ iptables -L you should then see a line like this:

ACCEPT     udp  --  anywhere             224.0.0.251          udp dpt:mdns

Thanks a lot matt for your help!!!

About Author

Marco Mornati

Marco Mornati

Hello, my name is Marco I'm a Software Engineer specialized in middleware environment and Linux Operating Systems.