0

I want to know if there is any way other than using linux bridges to interconnect interfaces from two virtual machines ?

Since I am trying to run private spanning tree implementation in virtual machines ... underlying linux bridge which connects both the virtual machines is dropping the BPDUs.

VirtualBox solves the issue by providing internal-network option.

Is there any similar option if I use KVM ?

Update-01: Enabling STP would end up creating a topology containing 3 bridges (2VMs and 1 Linux bridge connecting both the VMs) instead of 2 bridges (2VMs).

codingfreak
  • 591
  • 1
  • 7
  • 15

4 Answers4

0

Seems like you could use QEMU's -netdev socket option here, probably UDP version will fit better.

Also -netdev vde may work, although is more complicated and requires VDE switch daemon configured.

But I would try to overcome problem with Linux bridge anyway, with STP option enabled, as @Martin suggested. This is simple and very common setup.

sam_pan_mariusz
  • 2,133
  • 1
  • 14
  • 15
  • I have bad experience with VDE and personally don't recommend it in production environments. Use bridging instead. Why? VDE daemon runs in user space and can be killed for any reason. Also, lots of copy_to_user and copy_from_user calls make a performance issue (as we need to pass the data from-to kernel and back). The best is using TAP interfaces as they have the least overhead when running on production environments. – Vitaly Greck Apr 07 '15 at 19:23
  • Disabling STP in linux bridge which interconnects both virtual machines wont help me completely because there are condition check in linux bridge code to stop forwarding BPDUs when received on linux bridge – codingfreak Apr 16 '15 at 04:07
0

You can try to use the macvtap driver. Note that this does come with some limitation - be sure to read libvirt documentation about it.

shodanshok
  • 47,711
  • 7
  • 111
  • 180
0

QEmu/KVM provides the options to use a TAP interface in your host:

  1. when your host send an Ethernet frame to this interface, it is sent to the interface of your guest;

  2. when your guest sends an Ethernet frame to its interface, it is srnt to the TAP interface in your host.

You can create both VMS with TAP interfaces. Now you need to exchange the frames between the two TAP interfaces: you might be able to do this by writing a program which forwards Ethernet frames between the interfaces (using AF_PACKET, SOCK_RAW sockets) by receiving frames from one interface and sending them to the other one.

ysdx
  • 1,653
  • 12
  • 13
0

The people suggesting a TAP device were on the right track, but you need something else as well:

First, create a veth pair. This is a pair of virtual interfaces, each of which simply passes any traffic it receives to the other.

Next, attach one of your two VMs via macvtap to one of the veth interfaces in the pair, and attach the other VM to the other veth interface.

Finally, send some traffic.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972