I'm experimenting testing with multicast and I have a couple questions of how I can accomplish this.
First, is it absolutely necessary for me to have a router to accomplish multicast if the two systems are under the same subnet (i.e 10.10.1.10 and 10.10.1.12) or can I just have a switch or even point to point connection? I would say no because of some of the tests I've ran, but it'd be nice to know for sure.
Second, how can I set up, if at all possible, a multicast connection between my Windows 10 PC and a VMWare running CentOS7 on that same PC?
What I have right now:
A VMWare with a bridged network to my External Connection and running CentOS7. The VM has an IP of 10.10.1.12 and a netmask of 255.255.255.0 and the windows has a IP of 10.10.1.10 and a netmask of 255.255.255.0.
I've written a receive python script based on a something I've found running on the VM
import socket
import struct
MCAST_GRP = '224.0.0.71'
MCAST_PORT = 1000
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(('', MCAST_PORT))
mreq = struct.pack("4sl", socket.inet_aton(MCAST_GRP), socket.INADDR_ANY)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)
while True:
print sock.recv(10240)
and a sending python script from my host PC
import socket
MCAST_GRP = '224.0.0.71'
MCAST_PORT = 1000
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 2)
sock.sendto("robot", (MCAST_GRP, MCAST_PORT))
on my CentOS7 VM I can see the receive script is signing up to the group by running
netstat -g
I can also see the incoming packets by running
sudo tcpdump -i <NIC> host 224.0.0.0/4
which shows
14:28:03.111837 IP 10.10.1.101.60007 > 224.0.0.71.cadlock2: UDP, length 26
I can also see it in Wireshark as an incoming UDP message, but my python receive script running isn't receiving it.
I've also set net.ipv4.all.rp_filter to 0 that I've seen while doing research, but nothing.
However, I can run the send and receive scripts on the Windows PC and receive them just fine. I can even see them in Wireshark and they show up as IP 10.10.1.101 to 224.0.0.71 IPV4mcast.
I can also send messages from the VM to the host PC just fine. I just can't receive on the VM.