logo

jupfaf

some stuffs, and some others ...

Multicast between virtual machines in Virtualbox

Written by julien no comments

For some tests, I needed multicast to work between some virtual machines in Virtualbox, here are the steps I follow to have it enable. My guest OS is CentOs7.

VM configuration

In the network tab, add a new card with type internal network, and in the advanced option set the promiscuous mode to “allow all VMs”

System configuration

ip addr show
tell that the new card is recognized as enp0s9, so under /etc/sysconfig/network-scripts, create a file ifcfg-enp0s9 with the following content:


TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=192.168.57.11
PREFIX=24
DEFROUTE=no
IPV4_FAILURE_FATAL=yes
NAME=enp0s9
UUID=e280c669-e4fd-4a60-adb0-2d8d9c1015f0
DEVICE=enp0s9
ONBOOT=yes

(adapt to your need)

and a route-enp0s9 file containing:

224.0.0.0/4 via 192.168.57.11 dev enp0s9

This is to say the multicast traffic has to be routed on the internal network interface.

Then restart the network:

sudo systemctl restart network

Some kernel parameters has to be updated, edit the file /etc/sysctl.d/99-sysctl.conf and add the lines:


net.ipv4.icmp_echo_ignore_broadcasts=0
net.ipv4.ip_forward=1

Reload configuration:

sudo sysctl -p

And voilà, multicast should work between the VMs configured this way.