UDP multicast: three receivers

Deliver one UDP message to three receivers.

Network

Scroll sideways to exploreOpen full diagram
SW1 connects receivers PC1, PC2 and PC3 and sender PC4 in 192.168.1.0/24.
PC1–PC3 are receivers; PC4 is the sender.
Open a console

1. Join the multicast group

PC1

socat -u UDP4-RECV:12345,reuseaddr,ip-add-membership=224.16.12.1:192.168.1.1 OPEN:/tmp/lab-multicast.txt,creat,append &
listener_pid=$!

Repeat on PC2 with local address 192.168.1.2 and on PC3 with 192.168.1.3. Keep the same group and port.

2. Send a message

PC4

timeout 120 tcpdump -U --immediate-mode -i eth0 -w /tmp/lab-multicast.pcap "udp port 12345" &
capture_pid=$!
sleep 1

PC4

printf 'multicast-lab\n' | socat -u - UDP4-DATAGRAM:224.16.12.1:12345,ip-multicast-if=192.168.1.200,ip-multicast-ttl=1

3. Confirm delivery

PC4

sleep 2
kill -INT "$capture_pid"
wait "$capture_pid" || true
tcpdump -nn -e -r /tmp/lab-multicast.pcap

PC1, PC2, and PC3

cat /tmp/lab-multicast.txt
kill "$listener_pid"

All three files should contain multicast-lab. In the capture, find destination 224.16.12.1:12345 and MAC 01:00:5e:10:0c:01.

Validation

Click "Check". Once all steps pass, click "End".