Setup UDP multicast between 2 linodes in the same DC
I hope someone can help me with this:
I have had one linode as a playground for a while now. The last few months I have developed nodejs services that use UDP multicasting for a rudimentary heartbeat solution.
Last week I decided to expand to multiple linodes now that they support VLAN's as long as your linodes are hosted in the same data center.
Unfortunately I can't seem to get UDP multicasting to work. Maybe it is not supported?
Here are the details:
UDP server on linode 1 (nodejs code example):
const s = dgram.createSocket('udp4');
s.on("message", (_msg, _rai) => {
console.log('received udp message');
});
s.bind(52000, () => {
s.addMembership('239.128.1.1');
});
UDP client on linode 2:
const clientSocket = dgram.createSocket('udp4');
let message = 'test';
clientSocket.send(message, 0, message.length,52000,'239.128.1.1');
This works perfectly fine when the server and client execute on the same linode.
Both linodes have a public and a private ip address and a vlan. When the server is running I checked netstat:
netstat -gn:
lo 1 224.0.0.1
eth0 1 239.128.1.1
eth0 1 224.0.0.1
eth1 1 224.0.0.1
lo 1 ff02::1
lo 1 ff01::1
eth0 2 ff02::1:ffed:a2f5
eth0 2 ff02::1
eth0 1 ff01::1
eth1 1 ff02::1:ffed:a2f5
eth1 2 ff02::1
eth1 1 ff01::1
UDP Unicast over the VLAN IPAM (10.0.0.1 and 10.0.0.2) works fine.
I've disabled the firewall.
ufw status
Status: inactive
iptables are clean as a whistle as well.
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
I am wondering if the problem is that the multicast is associated with eth0. How can I ensure the VLAN is used for multicast messages?
What am I missing?
Thank you for any help.