I use AirPlay at home to stream audio from iTunes on my MacBook Pro running Mac OS X 10.7.3 to my AirPort Express in the bedroom and my Apple TV 3 in the living room. It's pretty slick. This works great until I connect to my work VPN using Cisco AnyConnect. Once I connect, and even after I disconnect from VPN and quit AnyConnect, the AirPlay pull-down menu in iTunes won't let me re-select either of the network speakers, and my music is trapped!
What's going on:
After some forum diving, I discovered that this is an IPv6 issue. After the AnyConnect session, AirPlay switches from IPv4 to IPv6, and never goes back until the Mac reboots. And apparently, AirPlay doesn't play nicely with IPv6. Awesome.
Here's the fix:
The good news for me is that I don't really need IPv6 on my Mac. Turning it off in Mac OS X 10.6 was a cinch.
Network Preferences -> Advanced -> TCP/IP -> Configure IPv6: Off.
But... the "Off" option is gone in Mac OS X 10.7! What gives? Apple doesn't want us using that option anymore. No problem, we can still set it in the command line.
networksetup -listallnetworkservicesAnd so on. If we go back to Network Preferences, the GUI will actually reflect this setting with "Off" appearing in the Configure IPv6 pull-down. AirPlay now works perfectly, even when I'm on the VPN. Hopefully by the time I need IPv6, Apple will have patched AirPlay accordingly.
networksetup -setv6off Ethernet
networksetup -setv6off Wi-Fi