Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I could successfully connect two different virtual machine ports directly using LAN segment feature in VMware workstation. Is there a way to do the same on qemu ?

As of now i have created two qemu vms and the two interfaces that i want to connect directly are on a bridge device. So i am able to ping both the interfaces from each of the vms. But the problem is that there is this layer 2 switch (bridge) in between the two vms which won't broadcast everything coming from one port to another, say the LLDP information.

I am simulating a network of Arista Switches using Arista EOS vms for the same. If someone could please point me how can i connect the two vms as if they were directly connected ?

I am using Open vSwitch as a hub and have connected the two required tap interfaces of vms onto the same. Only problem i am facing as of now is that the hub is dropping LLDP packets, i can clearly see that in the using switch controller. Most probably its due to IGMP snooping (though not sure and don't know much about it).

Thanks in advance.

share|improve this question

You can use the -net socket parameter to qemu (or kvm) to directly connect the QEMU instances using a TCP or UDP connection (instead of using -net tap). From the qemu manpage:

 # launch a first QEMU instance
 qemu linux.img -net nic,macaddr=52:54:00:12:34:56  -net socket,listen=:1234
 # connect the VLAN 0 of this instance to the VLAN 0 of the first instance
 qemu linux.img -net nic,macaddr=52:54:00:12:34:57  -net socket,connect=
share|improve this answer
Thanks for the quick response. But i don't want to connect just one or two ports of two vms together. I want them to be connected as if they are connected by an ethernet LAN segment. I have provided some more information in the question. – Jatin Kumar Jul 19 '12 at 9:44
@JatinKumar This doesn't just connect a specific port, it uses a QEMU feature to connect the networks of the two VMs directly. Instead of using TAP interfaces and a Linux bridge, QEMU uses TCP connections to tunnel the traffic. – mgorven Jul 19 '12 at 16:45

you can use VLANs to separate traffic. Simply take the nic, attach two different vlan tags to it, and put the vm bridges on the tagged interfaces. This will not only put the VMs on two different VLANs, but will also have them on two different bridges

share|improve this answer
Clarification: I don't want to do any sort of traffic filtering. All i want is to connect two ports as if they are connected by single lan segment – Jatin Kumar Jul 19 '12 at 16:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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