title: Multicasting with `socat` in Vagrant & VirtualBox Env
body: <p><strong>The problem</strong>: Each machine in the same network should be able to broadcast to all the members, including itself.</p>
  
  <p>This is an attempt to get working multicast with <code>socat</code> with VMs created in Vagrant &amp; VirtualBox Envrionment. It seems things are working differently here, so I first tried to see how multicast working on physical machines.</p>
  
  <p>I've 3 physical machines with ubuntu 12.04 server installed on them and named as <code>pc0</code>, <code>pc1</code> and <code>pc2</code>.</p>
  
  <p>On each machine I run:
  <code>socat STDIO UDP-DATAGRAM:224.0.0.1:2200,bind=:2200</code></p>
  
  <p>...and when I typed <code>hi from pc0</code> from <code>pc0</code>, it has broadcasted to itself and other 2 machines and this is what I wanted (and I hope this is how multicast supposed to work):</p>
  
  <pre><code>ubuntu@pc0:~$ socat STDIO UDP-DATAGRAM:224.0.0.1:2200,bind=:2200
  hi from pc0
  hi from pc0
  
  ubuntu@pc1:~$ socat STDIO UDP-DATAGRAM:224.0.0.1:2200,bind=:2200
  hi from pc0
  
  ubuntu@pc2:~$ socat STDIO UDP-DATAGRAM:224.0.0.1:2200,bind=:2200
  hi from pc0
  </code></pre>
  
  <p>I'm using the IP <code>224.0.0.1</code> as this is used by default for multicast on every machine.</p>
  
  <p>Next, I have tried to implement same stuff with 3 VMs, <code>vb0</code>, <code>vb1</code> and <code>vb2</code>. Github repo is <a href="https://github.com/tenzan/vagrant/tree/12fc25f5255c8d6d3db3fd14dd86344513306560" rel="nofollow">here</a>.</p>
  
  <p>Now I tried to broadcast from <code>vb0</code>:</p>
  
  <pre><code>vagrant@vb0:~$ socat STDIO UDP-DATAGRAM:224.0.0.1:2200,bind=:2200
  hello from vb0
  hello from vb0
  </code></pre>
  
  <p>...and it doesn't broadcast to the other members (as in case of the physical machines above) except itself.</p>
  
  <p>It seems, there are additional settings should be done prior to have this working...</p>
  
  <p><code>Vagrantfile</code>:</p>
  
  <pre><code>Vagrant.configure(2) do |config|
  
      config.vm.box = "ubuntu-12.04-x64"
      config.vm.synced_folder ".", "/vagrant", disabled: true
  
      config.vm.provider "virtualbox" do |vb|
          vb.cpus    = "2"
          vb.memory = "4096"
      end
  
      config.vm.provision "chef_apply" do |chef|
          chef.recipe = File.read("recipe.rb")
      end
  
      config.vm.define "vb0" do |vb0|
          vb0.vm.hostname = "vb0"
          vb0.vm.network "private_network", ip: "10.20.30.100"
      end
  
      config.vm.define "vb1" do |vb1|
          vb1.vm.hostname = "vb1"
          vb1.vm.network "private_network", ip: "10.20.30.101"
      end
  
      config.vm.define "vb2" do |vb2|
          vb2.vm.hostname = "vb2"
          vb2.vm.network "private_network", ip: "10.20.30.102"
      end
  
  end
  </code></pre>