Oleg Koval markOleg Koval

AirPrint on Any Linux NAS: The Universal Setup

By Oleg Koval·
Image: AirPrint on Any Linux NAS: The Universal Setup

AirPrint on Any Linux NAS: The Universal Setup

Tags: Networking · macOS · iOS · Printing · Linux · Synology · Open Source
Published: May 23, 2026


The Setup That Works Everywhere

I set up AirPrint for a Brother HL-1210W on a Synology DS918Plus. Every iOS and macOS device on the network now discovers the printer instantly.

The technique is universal—it works on Raspberry Pi, Ubuntu NAS, Docker, or any Linux box. Only the startup method changes.

Why This Matters

Network printers without AirPrint are invisible to Apple devices. You either replace the printer (~$200+) or turn your Linux box into a print server.

I chose option two. Five minutes of setup, zero hardware cost beyond electricity.

What You Need

  • Any Linux NAS or server (Synology DSM 7.x, Raspberry Pi, Ubuntu, Docker, etc.)
  • Brother printer or any network-capable printer with IPP/LPD support
  • Printer connected to WiFi
  • SSH access to your server
  • Minimal sudoers privilege

The Problem

CUPS (Linux print server) + Avahi (mDNS daemon) let your NAS advertise the printer as AirPrint-compatible.

But getting them talking requires finding the right protocol. Synology adds friction: no systemd, custom init, undocumented paths.


Universal Setup (Core Steps)

1. SSH into Your NAS/Server

Bash1 lines
ssh user@[SERVER_IP]

2. Find Your Printer's IP Address

Run this scan to locate the printer:

Bash3 lines
for ip in 192.168.1.{1..254}; do 
  timeout 0.1 bash -c "</dev/tcp/$ip/631" 2>/dev/null && echo "Found printer: $ip"
done

Note the IP (example: 192.168.178.44)

3. Configure CUPS

First, kill any running CUPS daemon:

Bash2 lines
sudo killall cupsd 2>/dev/null || true
sleep 2

Create the CUPS configuration file:

Bash30 lines
sudo tee /etc/cups/cupsd.conf > /dev/null << 'EOFCUPS'
LogLevel warn
MaxLogSize 0
Listen 0.0.0.0:631
Port 631
Browsing On
BrowseLocalProtocols dnssd
DefaultAuthType Basic
WebInterface Yes

<Location />
  Allow @LOCAL
</Location>

<Location /admin>
  Order allow,deny
</Location>

<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
  Order allow,deny
</Location>

<Policy default>
  <Limit All>
    Order deny,allow
  </Limit>
</Policy>
EOFCUPS

4. Start CUPS and Add Your Printer

Start the CUPS daemon:

Bash2 lines
sudo /usr/bin/cupsd -F &
sleep 2

Add your printer using LPD protocol (more reliable than IPP):

Bash1 lines
sudo lpadmin -p Brother-HL-1210W -E -v lpd://192.168.178.44

Verify it was added:

Bash1 lines
lpstat -p -d

You should see device for Brother-HL-1210W: lpd://192.168.178.44

5. Create the Avahi Service File

This tells Apple devices the printer supports AirPrint:

Bash17 lines
sudo tee /etc/avahi/services/airprint-brother.service > /dev/null << 'EOFAVAHI'
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name>AirPrint Server - Brother HL-1210W</name>
  <service>
    <type>_ipp._tcp</type>
    <port>631</port>
    <txt-record>txtvers=1</txt-record>
    <txt-record>qtotal=1</txt-record>
    <txt-record>rp=printers/Brother-HL-1210W</txt-record>
    <txt-record>ty=Brother HL-1210W</txt-record>
    <txt-record>pdl=application/postscript,image/urf</txt-record>
    <txt-record>URF=W8,SRGB24,CP255</txt-record>
  </service>
</service-group>
EOFAVAHI

6. Start Avahi (mDNS Broadcasting)

Bash2 lines
sudo /usr/sbin/avahi-daemon &
sleep 2

Verify it's advertising the printer:

Bash1 lines
avahi-browse -a | grep -i airprint

7. Test from iOS or macOS

On iOS: Settings → Printers & Scanners → tap printer → Print Test Page

On macOS: System Preferences → Printers & Scanners → add printer

You should see your printer appear and print immediately. No drivers needed.


Auto-Start on Reboot

Pick the setup that matches your OS:

Synology DSM 7

Create startup script:

Bash9 lines
sudo tee /usr/local/bin/start-airprint.sh > /dev/null << 'EOFSYNO'
#!/bin/bash
sleep 5
/usr/bin/cupsd -F &
sleep 2
/usr/sbin/avahi-daemon &
EOFSYNO

sudo chmod +x /usr/local/bin/start-airprint.sh

Add to cron:

Bash2 lines
sudo crontab -e
# Add this line: @reboot /usr/local/bin/start-airprint.sh

Ubuntu / Debian / Raspberry Pi (systemd)

Create a systemd service:

Bash18 lines
sudo tee /etc/systemd/system/airprint.service > /dev/null << 'EOFSYS'
[Unit]
Description=AirPrint Server
After=network.target

[Service]
Type=forking
ExecStart=/usr/bin/cupsd
ExecStart=/usr/sbin/avahi-daemon
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOFSYS

sudo systemctl daemon-reload
sudo systemctl enable airprint
sudo systemctl start airprint

Docker

Dockerfile5 lines
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y cups avahi-daemon
COPY cupsd.conf /etc/cups/
COPY airprint-brother.service /etc/avahi/services/
CMD ["/usr/sbin/cupsd", "-F"] & ["/usr/sbin/avahi-daemon"]

Troubleshooting

Printer appears then disappears

Cause: CUPS is only listening on localhost, not the network.

Fix: Verify Listen 0.0.0.0:631 in cupsd.conf, then restart CUPS.

Print jobs stuck in queue

Cause: Physical jam or printer error.

Fix:

  1. Check printer tray for paper jams
  2. Power cycle printer for 10 seconds
  3. Check printer's web interface for persistent errors

Blank pages printing

Cause: PostScript mismatch. Printer doesn't support PostScript (common with Brother models).

Fix for Synology DSM 7:

Bash23 lines
sudo lpadmin -p Brother-HL-1210W -o raw-queue=True
sudo rm /etc/avahi/services/airprint-brother.service

sudo tee /etc/avahi/services/airprint-custom.service > /dev/null << 'EOFFIX'
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">AirPrint %h - Brother HL-1210W</name>
  <service>
    <type>_ipp._tcp</type>
    <port>631</port>
    <txt-record>txtvers=1</txt-record>
    <txt-record>rp=printers/Brother-HL-1210W</txt-record>
    <txt-record>ty=Brother HL-1210W</txt-record>
    <txt-record>pdl=application/pdf,image/jpeg,image/png,image/urf</txt-record>
    <txt-record>URF=W8,SRGB24,CP1,RS600</txt-record>
  </service>
</service-group>
EOFFIX

sudo /usr/sbin/avahi-daemon -k
sleep 2
sudo /usr/sbin/avahi-daemon &

This removes PostScript from advertised formats. iOS/macOS will send PDF or URF instead, which non-PostScript printers can handle.

Fix for Ubuntu/Raspberry Pi: Use the correct printer driver in the Avahi service file
Fix for Docker: Build image with the correct printer driver

Two printer entries on iPhone

Cause: Same service advertising on multiple network interfaces.

Fix: Forget and rejoin WiFi on the iPhone.

Printer shows offline

Cause: Printer lost WiFi connection or IP changed.

Fix:

  1. Reconnect printer to WiFi
  2. Verify printer IP hasn't changed
  3. Update CUPS configuration if needed

Why This Works

  • CUPS translates between AirPrint (IPP) and your printer's native protocol (LPD, raw, etc.)
  • Avahi broadcasts the printer via Bonjour—Apple's zero-config networking standard
  • LPD protocol is more reliable than raw IPP for older network printers
  • One printer, many devices, no driver installation per device

Full Setup Scripts & Contributing

Complete setup + automation scripts:
github.com/oleg-koval/universal-airprint-setup

Tested on: Synology DS918Plus · Raspberry Pi 4 · Ubuntu 24.04

Contributing: PRs welcome. Include your hardware + OS version.


Why I Built This

My Brother printer works perfectly but has zero AirPrint support. Replacing it would cost $200+.

Turning my NAS into a print server cost 5 minutes and electricity.

The core technique is just CUPS + Avahi. The friction is platform-specific init systems and documentation gaps. Now printing from iOS just works everywhere.