Using Multicast on a LAN in Linux
Some quick notes on testing that multicast is working inside a LAN. Multicast support primarily depends on the Ethernet switch. In our network lab we have HP 24-port Gigabit Ethernet switches (HP 1910-24G or 1810-24G??). Like most business-oriented switches, they support multicast (your home/desktop switch probably does not support multicast). Note that the focus is on multicast only inside the LAN, i.e. one LAN computer sends a packet, and a selection of other computers on the same LAN receive a copy of that packet. This does not address multicast routing, i.e. allowing a computer to send to a group of computers on different LANs/subnets.
Testing Multicast with iperf
iperf supports multicast. First, make sure it is installed on all the computers that you want to use multicast:
instructor@netlab01:~$ sudo apt-get install iperf
On each computer that you want to receive data, start iperf in server mode:
student@netlab02:~$ iperf -s -u -B 22.214.171.124 -i 1
Now on the sending computer, start iperf in client mode:
student@netlab01:~$ iperf -c 126.96.36.199 -u -T 32 -t 3 -i 1
You should see reports at the sender (client) and each of the receivers (servers) showing that 1Mb/s of UDP traffic is being delivered. The -B option binds the servers to the default multicast address used in a LAN, 188.8.131.52. The client sends UDP at a rate of 1 Mb/s (to change the sending rate use the -b option on the client) to the multicast address for 3 seconds, displaying a report with an interval of 1 second.
To double-check that multicast is indeed being used (i.e. the client sends one copy of each packet to the switch, and then the switch sends copies of that packet to each server) you can capture packets with tcpdump on the client while performing the iperf test:
student@netlab01:~$ sudo tcpdump -i eth0 -n 'udp' -w clientsend.cap
Use Wireshark to check the captured packets amount to a rate of 1Mb/s.
Transferring Files with udpcast
You can use udpcast to transfer a file from sender computer to multiple receiver computers. First install it on each computer:
instructor@netlab01:~$ sudo apt-get install udpcast
For testing purposes, create a random file on the sender computer. For example, you can use dd to create a 1GB file:
student@netlab01:~$ dd if=/dev/urandom of=rand.bin bs=1M count=1000
On each computer that you want to receive data, start udp-receiver:
student@netlab02:~$ udp-receiver --file rand.bin
Now on the sending computer, start udp-sender:
student@netlab01:~$ udp-sender --file rand.bin
You will be prompted to press a key to begin the transfer, then the file should be transferred to each receiver using multicast.
Now you have a way to send files to selected/all computers in a LAN, e.g. for distributing files or upgrading software in a computer lab.
Created on Mon, 09 Mar 2015, 4:54pm
Last changed on Mon, 09 Mar 2015, 6:40pm