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).

  • 1
    VDE ? – user186340 Feb 26 '15 at 6:58
  • 1
    You can enable STP on linux bridge : linuxfoundation.org/collaborate/workgroups/networking/… – Martin Feb 26 '15 at 7:11
  • @AndréDaniel - Can I use VDE with Linux KVM ? – codingfreak Mar 12 '15 at 4:58
  • @Martin Enabling STP will create wrong behaviour in my case since I want the linux bridge which is interconnecting interfaces of VM as a dummy interconnection link. – codingfreak Mar 12 '15 at 4:58
  • @codingfreak sure. – user186340 Mar 12 '15 at 5:02
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.

  • 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 7 '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 4: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.

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.

  • Hmm ... but this ends up creating more manual form of adding interfaces to VMs and connecting them together – codingfreak Apr 19 '15 at 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.