This guide is a 5 step process to enable Airplay across VLANs and subnets.
Having recently split the ever more complicated network in work into smaller VLANS we discovered that Airplay across VLANs was a bit of a problem.
To enable you to run Airplay across VLANs you will need a PC to run UNIX on (we used Debian) and access to the internet. It is possible to do this using a Rasberry Pi but I would not recommend it.
STEP ONE: Install UNIX (Debian) Server on your host
Do this from a disc (follow install prompts)
In our configuration we initially untagged one VLAN on the switch the UNIX box is connected to and set the UNIX box to obtain a DHCP address.
This will work for the initial setup and will need to be changed later.
All of the commands in blue in the guide are run from the UNIX command line.
STEP TWO: Check for updates and upgrades then install Avahi and VLAN support
Once the install is complete and the DHCP address is assigned download and install updates and upgrades for the UNIX box
apt-get update && apt-get upgrade
Once this is finished run
apt-get install vlan
You need to check that the updates and upgrades are applied to VLANs so re run (to check)
apt-get update && apt-get upgrade
STEP THREE: Add VLANS to the box
When all the updates are applied you will need to start the VLAN service on the UNIX box
modprobe 8021q
The above command will start the VLAN service running but will be lost upon reboot. To ensure that the VLANs will work after a reboot you will need to add the 8021q to the modules loaded at boot
su –c ‘echo “8021q” >> /etc/modules’
Once the VLAN service is running you will need to add a VLAN for each VLAN you have on the network, to do this run (for instance)
vconfig add eth0 1171
The above will add a VLAN as eth0.1171, we have several so you will need to run the above for each VLAN changing the VLAN ID for each. This assumes you are using eth0 as the raw device name. Once you have added all of the VLAN IDs run
cat /proc/net/VLAN/config
This will display all of the VLAN IDs you have created and you can check they are right, ours looks like this. Once you are happy that all of the VLANs are created you will need to create a fixed IP address for each VLAN. This is done by editing the network interfaces file one of two ways:
nano /etc/network/interfaces
Ours looks like this. The easier way (for us) to do this was to create a copy of the file using a text editor on windows and save the file as interfaces.txt. Once the file is saved there is a backup/recovery version of the file for DR.
Copy the file to the UNIX box (using sFTP, port 22), you may need to copy this to a user space then move it using the root login directly on the server we have a user called admin so we copied it to /home/admin then moved it using:
cp /home/admin/interfaces.txt /etc/networking/interfaces
The above command will overwrite the existing file. After you have all of the VLANs created and the interfaces file in place you will need to either reboot the server or run
ifdown eth0
ifup eth0
/etc/init.d/networking restart
The network should restart and will show OK on the screen. After this run the command below to check the network config is correct
ifconfig
The output of ours looks like this. At worst it may be a good idea to reboot the server at this point, all services should start OK.
STEP FOUR: Test the VLAN configuration
Once you are done you should be able to ping any of the IP addresses created on the UNIX box from a windows desktop. This is provided that the VLANs that the IP addresses reside in are tagged on the switch port the UNIX box is connected to (we tagged them all for obvious reasons).
If you get a ping response from all the IP addresses then go to step 5 – caveat; when we tried this with an Ubuntu build we found that there was only a ping response from a device within the same VLAN, this did not mean the system would not work, but, using Debian worked and did not exhibit this behaviour. Always remember that if you are using Ubuntu you need to precede every command with ‘sudo ‘ (because otherwise pretty much nothing works and files are opened read only in nano).
STEP FIVE: INSTALL Avahi to enable Airplay across VLANs and subnets
Install avahi-daemon and avahi-utils using the following command
apt-get install avahi-daemon avahi-utils
Once again check that updates and upgrades have been applied to the Avahi packages
apt-get update && apt-get upgrade
Edit the config file for the Avahi daemon
nano /etc/avahi/avahi-daemon.conf
Change the line
#enable_reflector=no
to
enable_reflector=yes
Save the file and exit nano
At this point reboot the box, once done; you should be able to airplay across VLANs e.g. from an iPhone or iPad in one (wireless) VLAN to a desktop PC in another (wired or wireless) VLAN.
Further information about Avahi can be found at http://avahi.org/
Incidentally none of this is necessary if you are running an Aruba Wifi system, you simply enable airplay and setup your VLANS in the Aruba controller. Best turn off Avahi if you do this because they don’t play well together…..