alsmith / multicast-relay

Relay multicast and broadcast packets between interfaces.
GNU General Public License v3.0
304 stars 47 forks source link

Support for tunneling between two instances #13

Closed elupus closed 4 years ago

elupus commented 5 years ago

Think you could look at tunneling between two instances?

PS. Why the need for raw sockets? Is it spoofing source ip?

alsmith commented 5 years ago

In theory it ought to work, e.g. if you have net1 - A - net2 - B - net3 and run the relay on 'A' and 'B' then devices on net1 ought to be able to see devices on net3.

But sending packets over a longer distance where you're not necessarily in control of the routers in between isn't something that I've considered up to now. Do feel free to submit a patch, however!

raw sockets are because we muck around with the ethernet macs.

elupus commented 5 years ago

My case would be vpn, in which case you are in control.

It could be quite neat, and generic. Ie just run two instances on same host for current use case. Each instance listening to one interface.

I'll see if I look at it.

Den lör 16 feb. 2019 10:37 skrev Al Smith notifications@github.com:

In theory it ought to work, e.g. if you have net1 - A - net2 - B - net3 and run the relay on 'A' and 'B' then devices on net1 ought to be able to see devices on net3.

But sending packets over a longer distance where you're not necessarily in control of the routers in between isn't something that I've considered up to now. Do feel free to submit a patch, however!

raw sockets are because we muck around with the ethernet macs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alsmith/multicast-relay/issues/13#issuecomment-464324981, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdeoP1R3t91v9EXXoU1xv3x91j2nzj_ks5vN9ExgaJpZM4a83U- .

alsmith commented 5 years ago

It actually works as-is over openvpn... for example I can run the Sonos app on my mac, connect via tunnelblick and operate the speakers at home using the relay. You'd just have to add 'tun0' to the list of interfaces that it listens on, eg

multicast-relay.py --interfaces eth0 eth1 tun0

elupus commented 5 years ago

I have a router to router VPN. With routers not able to run python. Sophos and pfsense. So can't get it to handle things. Need to be outside of those.

Den lör 16 feb. 2019 11:28 skrev Al Smith notifications@github.com:

It actually works as-is over openvpn... for example I can run the Sonos app on my mac, connect via tunnelblick and operate the speakers at home using the relay. You'd just have to add 'tun0' to the list of interfaces that it listens on, eg

multicast-relay.py --interfaces eth0 eth1 tun0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alsmith/multicast-relay/issues/13#issuecomment-464333896, or mute the thread https://github.com/notifications/unsubscribe-auth/AAdeoJuHL4kn3ouxy7s3mZ8QGCSY-0eZks5vN90mgaJpZM4a83U- .

elupus commented 5 years ago

Just for reference. I actually did start on this 3 years ago https://github.com/elupus/ssdpgateway had forgotten I put it on github :)

Though now that I look at it I didn't get so far.

agillis commented 4 years ago

I would be interested in this as well. The is why we need this feature. Imaging two subnets on the same router 10.0.1.x and 10.0.2.x you can not replace or modify the router but you want Sonos on both networks. You put a small computer on each network running the bridge and it bridges the traffic over to the other network. I would pay you to develop this feature if you are interested.

alsmith commented 4 years ago

Let me see what I can do - tunneling between instances ought to be fairly straightforward in fact...

alsmith commented 4 years ago

Hi @elupus / @agillis - engineering work has started on https://github.com/alsmith/multicast-relay/tree/remoteRelay

I haven't been able to test it at the moment, if you feel brave then have a go and do report back, otherwise I'll have to chance to test it out tomorrow evening.

alsmith commented 4 years ago

The code works and I can see packets being broadcast around the place. I don't quite have the ability to test this on fully-separate networks, however. @agillis ?

alsmith commented 4 years ago

Testing complete - I found a couple of bugs that needed to be fixed but it's now stable and it does the job. One wrinkle is that if the TCP connection between the instances goes down, it doesn't automatically recover. That'll be an enhancement for a later date.

alsmith commented 4 years ago

PR #22 merged.

alsmith commented 4 years ago

In particular, given that my testing environment consists of netA - server - netB - pi - VPN - pi - netC, where one multicast-relay is running on the server relaying packets between netA and netB, and the two Pis are running in a --remote / --listen config, I can see packets being emitted on netC that originated on netA, and vice versa. Perfect !

elupus commented 4 years ago

Nice! I will have a look!