Linux firewall settings for Apple Airplay (Shairport / Shairtunes / Shairplay)

VS. 


The following has taken me an eternity to figure out. I use Airplay from a Linux server to Apple and other airplay devices on my network. Configuring the firewall properly for this to work has not been simple - many guides are vague and lack the specifics needed.

My actual configuration centres around Logitech's squeezeboxserver now known as logitechmediaserver 'LMS' whereby I use the following plugins:

AirPlay bridge - this enables Airplay devices to be used as if they were squeezebox devices, i.e. I can play my LMS stored music / radio / spotify on any of my Airplay devices

ShairTunes2 - this enables Squeezebox devices to be Airplayed to, i.e. I can Airplay from my iPhone/iPad/Mac etc. to any of my LMS squeezebox devices. This is an incarnation of shairplay / shairport .

For along time I have had to disable my firewall to enable my LMS device to connect to my Airplay devices and for music to flow. Once the connection is established I had to then re-enable my firewall - which is not ideal and very cumbersome. Whilst the Airplay devices always showed up in LMS and LMS client the music would just not stream. 

Here's how to configure a linux firewall with UFW to enable Airplay: