mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.25k stars 574 forks source link

Airfoil don't see shairport #123

Closed archont94 closed 9 years ago

archont94 commented 9 years ago

Hi, Long time ago, on my previous Banana Pi I was using shairport. Now I make fresh install of system and I try to run shairport-sync. Installation proces goes smooth without any problems, but my streaming program, Airfoil (on PC) don't see server, also Android program doesn't see anything. When I run shairport4w on PC Airfoil and Android client can see each other, so this must be something with configuration. Could you help me?

joerg-krause commented 9 years ago

Do you use the avahi or the tinysvcmdns backend?

archont94 commented 9 years ago

Yes, when I was install I use Avahi

joerg-krause commented 9 years ago

Which version of shairport-sync do you use? Have you configured shairport-sync properly?

archont94 commented 9 years ago

shairport-sync -V 2.4-openssl-Avahi-ALSA-soxr-metadata

Shairport daemon start normall without any errors. Even if audio device is configured wrong, I should see server and after connecting I should get error (that was like in shairport)

mikebrady commented 9 years ago

Hi there. Thanks for your interest in Shairport Sync. It would be good to check if the program is actually running – do ps aux | grep shai or similar to make sure it's running. It will die if it can't find a suitable audio device.

archont94 commented 9 years ago

root@bananapi ~ # ps aux | grep shai root 4256 0.5 0.1 21676 1264 ? Sl 22:49 0:00 /usr/local/bin/shairport-sync -d root 4262 0.0 0.0 3128 708 pts/0 S+ 22:49 0:00 grep --color=auto shai

Yes, it's running

joerg-krause commented 9 years ago

Is the Pi in the same network as your PC?

mikebrady commented 9 years ago

Thanks. Is there any possibility of a firewall running somewhere in the network and causing problems?

If you had a Mac or iOS device handy you could use Bomjour Browser (called Discovery on iOS to see what's being advertised.

archont94 commented 9 years ago

Yes, this is the same network... I don't think that it could be firewall, I have a lot of things on this server (samba, CUPS, webserver) and all works fine. UnfortunatelyI don't have any Apple device.

mikebrady commented 9 years ago

Bomjour -> Bonjour, duh.

mikebrady commented 9 years ago

Thanks. Does this server, by any chance, also act as a router or access point? In other words, could it have access to two separate networks?

Instead of Bonjour Browser, there is a browser in avahi-utils that should give you an idea what's being advertised via mdns.

archont94 commented 9 years ago

No, it is a usual "computer" which take address from router and that's it, no any AP etc on Banana. No, it have only one network. Could you write something more about that browser? How to check that?

mikebrady commented 9 years ago

There's a bunch of command line utilities in the alsa-utils package. I think one of them is called something like avahi-browse and it will display mdns info that it can find. See http://www.gnuton.org/blog/2009/03/using-avahi/ for example.

archont94 commented 9 years ago

root@bananapi /home # avahi-browse -a

mikebrady commented 9 years ago

That looks right, so it seems Shairport Sync is indeed advertising itself. I wonder if it can be seen at the AirFoil or Android machine? Is there any way of running the avahi-browse command on another machin on the network?

archont94 commented 9 years ago

So, Banana info: root@bananapi ~ # iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination

Chain FORWARD (policy ACCEPT) target prot opt source destination

Chain OUTPUT (policy ACCEPT) target prot opt source destination

And info from other computer int the same network: nmap PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 111/tcp open rpcbind 139/tcp open netbios-ssn 445/tcp open microsoft-ds 631/tcp open ipp 5000/tcp open upnp 5002/tcp open rfe

avahi-browse -a

And this is curious, becouse I cannot see shairport even if port is open and iptables let any connections.

archont94 commented 9 years ago

I has to be Banana firewall or something - I just install shairport on my laptop and Android see this server. iptables -L look the same on both computers. Any ideas?

I try to force connection from Android AirAudio - and this works fine. So problem is with "broadcast" information about running shairport (so Airfoil don't see it)

mikebrady commented 9 years ago

So, if you temporarily completely disable the firewall what happens? I don't know which ports are used by mdns. Shairport Sync uses port 5000 and ports 6001--6003. Also, would this have any significance in your case? "To enable multicast for tinysvcmdns, you may have to add a default route with the following command: route add -net 224.0.0.0 netmask 224.0.0.0 eth0 (substitute the correct network port for eth0)."

archont94 commented 9 years ago

I flush all iptables configuration, so it should pass all conection. I add "route.." as you write, bu this doesn't help. I don't have any idea what is wrong...

mikebrady commented 9 years ago

If you actually completely disable the firewall -- that it, turn it off, disable it and restart the computer, so that the firewall is definitively out of the picture, without the possibility of misconfiguration -- does connectivity happen? (BTW, are we talking about Shairport Sync or another version of Shairport?)

archont94 commented 9 years ago

Yes, we talking about Shairport Sync. Of course I try to reboot, but this doesn't change anything.

mikebrady commented 9 years ago

Intriguing. I think it might be necessary to try out WireShark or TCPdump to see whether the right mDNS packets are being seen. Is Bonjour/Avahi working for other services on the server?

archont94 commented 9 years ago

No, only Shairport use Avahi. I try tommorow with wireshark and try make something with iptables etc.

mikebrady commented 9 years ago

I have a vague memory of an issue with mDNS requiring multicast to be enabled on the device's ethernet card. Can't find a reference to it though. Does it ring any bells with you? (E.g. have you disabled multicast on the device?)

archont94 commented 9 years ago

No, I don't remember any change connected with mulicast.

root@bananapi ~ # ip maddr show
1: lo inet 224.0.0.1 inet6 ff02::1 2: eth0 link 01:00:5e:00:00:01 link 33:33:00:00:00:01 link 01:00:5e:00:00:fb link 01:00:5e:7f:ff:fa inet 239.255.255.250 users 2 inet 224.0.0.251 inet 224.0.0.1 inet6 ff02::1 3: tunl0 inet6 ff02::1 root@bananapi ~ # ifconfig eth0 eth0 Link encap:Ethernet HWaddr 02:8c:03:42:9a:b6 inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1273818 errors:0 dropped:0 overruns:0 frame:0 TX packets:1098324 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1322673971 (1.2 GiB) TX bytes:133206757 (127.0 MiB) Interrupt:117 Base address:0xc000

mikebrady commented 9 years ago

Very curious. Is avahi-daemon running? I get:

$ps aux | grep avahi
avahi      909  0.0  0.0  32352  1672 ?        S    20:12   0:00 avahi-daemon: running [ubuntu.local]
avahi      921  0.0  0.0  32220   464 ?        S    20:12   0:00 avahi-daemon: chroot helper
mike      2808  0.0  0.0  15940   940 pts/10   S+   20:13   0:00 grep --color=auto avahi

on Ubuntu 14.04, for instance.

archont94 commented 9 years ago

The same: root@bananapi ~ # ps aux | grep avahi
avahi 2101 0.0 0.1 2884 1444 ? S Sep15 0:00 avahi-daemon: running [bananapi.local] avahi 2104 0.0 0.0 2760 488 ? S Sep15 0:00 avahi-daemon: chroot helper root 12506 0.0 0.0 3132 752 pts/0 S+ 21:15 0:00 grep --color=auto avahi

mikebrady commented 9 years ago

Good. Can you $ping bananapi.local from another machine on the network?

$ ping ubuntu.local
PING ubuntu.local (192.168.2.20): 56 data bytes
64 bytes from 192.168.2.20: icmp_seq=0 ttl=64 time=0.361 ms
64 bytes from 192.168.2.20: icmp_seq=1 ttl=64 time=0.372 ms
64 bytes from 192.168.2.20: icmp_seq=2 ttl=64 time=0.436 ms
^C
archont94 commented 9 years ago

Yes: C:\Users\Archont>ping bananapi.local

Pinging bananapi [192.168.0.3] with 32 bytes of data: Reply from 192.168.0.3: bytes=32 time=7ms TTL=64 Reply from 192.168.0.3: bytes=32 time=4ms TTL=64 Reply from 192.168.0.3: bytes=32 time=3ms TTL=64 Reply from 192.168.0.3: bytes=32 time=3ms TTL=64

mikebrady commented 9 years ago

That's good -- some part of avahi is working, at least.

archont94 commented 9 years ago

OK, so you have any idea what can be wrong?

mikebrady commented 9 years ago

Clutching at straws here TBH. Can you run a portscan against your server? See what ports are open?

mikebrady commented 9 years ago

Does your laptop have that crazy Windows network stuff -- can't remember, but you specify how "safe" your network is -- Public, Work, Home, etc. If you can turn all that stuff off, or make it most permissive (?)

archont94 commented 9 years ago

Nmap scan report for 192.168.0.3 Host is up (0.033s latency). Not shown: 991 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 111/tcp open rpcbind 139/tcp open netbios-ssn 445/tcp open microsoft-ds 631/tcp open ipp 5000/tcp open upnp 8200/tcp open trivnet1

Windows firewall don't make that issue, becouse I also try to send audio from Android phone - if I run shairport on laptop with Windows or Debian, I can send it using Android, but it doesn't see server on Banana (but if I write manual address it can connect).

mikebrady commented 9 years ago

I'm afraid I'm at a loss to explain this. It seems that Shairport Sync is being advertised on Avahi/Bonjour/ZEROCONF, yet no devices beyond bananapi itself seem to be able to see it. It really does seem like a firewall-like issue. Is it possible that some devices are on WiFi and some on ethernet, connected via the access point / router? What kind of router / software is it? (Sometimes mDNS is not correctly carried across the different parts of the switch.)

archont94 commented 9 years ago

Yes, laptop is connected over wifi and banana over ethernet, but to the same AP. This is device from Polish ISP called UPC. What options I should look for?

mikebrady commented 9 years ago

I'm afraid I don't know. I am on UPC too, in Ireland, with a Cisco EPC3925 router which is just fine. However, what I'm wondering is if your router might be actually faulty, and I don't really know how to check.

To get around that, I'm guessing that Android is on WiFi as well as the laptop -- thus both devices, laptop and Android, are on the WiFi side and don't cross the WiFi / Ethernet fabric. Is that correct?

So, if you could put your laptop on the ethernet side, you'd have the laptop and the bananapi on the Ethernet side and wouldn't cross the WiFi / Ethernet fabric. If it's easy, it's certainly worth a try.

archont94 commented 9 years ago

I'm moron - this is fault of AP for 100% - I connected Banana and Android phone to diffrent temporary wifi AP and all works fine, so I need to find something in UPC configuration. I'm really sorry for trouble, becuse it wasn't fault of your software. I hope that I can find issue.

Regars Archont

mikebrady commented 9 years ago

Excellent, you got a result! Thanks for your persistence!

archont94 commented 9 years ago

And once again - you was right - when I connect laptop to UPC AP using ethernet, I saw shairport server. I try to figure out how to repair that and if it will be nesesery I write to UPC. Could you just write me which ports I need?

mikebrady commented 9 years ago

The ports used by Shairport Sync are 5000, 6001, 2 and 3. However, I suspect the problem is with multicast across the fabric of the switch. It's not clear whether the cause of the problem is a bug or a feature. You might have to get UPC to replace the AP. If I was you, I'd google the modem's model and see if there are any reports of interest.

mikebrady commented 9 years ago

BTW, I think it's a bug rather than a feature :)

mikebrady commented 9 years ago

Closing the issue. Feel free to reopen if you have more information.