0

I'm a linux beginner and trying to test multicast with socat on Ubuntu which works.
A bit "too well" actually (or I'm misunderstanding something fundamental)

my network looks that (ifconfig, abbreviated)

ens33 - 192.168.2.10 lo - 127.0.0.1 vboxnet0 - 5 - 192.168.56.1 and up to 192.168.1.1 vboxnet6 - 192.168.1.1 vboxnet7 - 10.0.1.1 vboxnet8 - 192.88.99.1 

I start socat in two consoles like that
receiver
socat -d -d UDP-RECVFROM:6666,ip-add-membership=233.168.0.100:192.68.56.1:ens33,fork EXEC:hostname

sender
socat -d -d STDIO UDP4-DATAGRAM:233.18.0.100:6666,range=192.168.56.100/30

It doesn't matter what I choose as multicast address, as long as they match.
And I have to specify the interface on the receiver side for it to work.

Like I said at the beginning the receiver receives messages and that's the problem.

If I'm not mistaken it shouldn't because it is not i the defined range of 192.168.56.100/30 which translates to 192.168.56.101 - 192.168.56.103
the receiver always receives packages no matter what IP.

Am I misunderstanding what range actually does?
What am I missing?

I suspect it has something to with being on the same device (routing).

2
  • It would be interesting to know what you think multicast is for. Commented Jun 10, 2020 at 12:54
  • as far as I know it's for sending packets to a subset of addresses which have registered beforehand with the multicast address. Instead of broadcasting packets to everybody. Commented Jun 10, 2020 at 12:57

1 Answer 1

1

Multicasting is behaving as it is supposed to work.

When you are signaling an interface to listen for a multicast address, in fact, you are associating the underlying interface with that address and not the IP address of that interface.

So as long as you are sharing the same physical/virtual medium/network, all the interfaces associated with the multicast address will receive a multicast transmission.

4
  • 1
    recommended reading material amazon.com/… Commented Jun 10, 2020 at 13:07
  • thanks, but then it seems I completly misunderstood socats range parameter. Meaning: the range parameter filters incoming packets. I focused on that parameter way too hard (in the wrong way)... Commented Jun 10, 2020 at 13:43
  • just an additional hint for others. Don't use 224.0.0.1 as multicast adress like described here -> dest-unreach.org/socat/doc/socat-multicast.html#ALLSYSTEMS. Every socket is automatically member of this group. Just use something different. Probably something not found with netstat -gn before you start testing Commented Jun 11, 2020 at 6:12
  • @Arikael There are other groups, like the ALL ROUTERS. You should not be abusing 244/8, for several reasons. See this "The 239.0.0.0/8 range is assigned by RFC 2365 for private use within an organization. Per the RFC, packets destined to administratively scoped IPv4 multicast addresses do not cross administratively defined organizational boundaries, and administratively scoped IPv4 multicast addresses are locally assigned and do not have to be globally unique. " . I would suggest opening other questions for related subjects, and not using comments. Commented Jun 11, 2020 at 10:11

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.