Eating My Own (Socket) Dog Food - QEMU

I have submitted some draft patches to the QEMU project in July, but they are not upstream at present. I am presently out of brain cycles to push an updated version, I will try to get back to it whenever I have some spare time on my hands.


NOTE: only L2TPv3 is shipping in QEMU/kvm 2.1. The rest were published recently and I am working for their inclusion into QEMU/kvm.

If you have recent enough QEMU it will support the L2TPv3 transport. In order to connect to the PWE set up in the previous section, we will need to reverse the source and destination as well as source port and destination port if present.

qemu-system-x86_64 -hda /exports/kvm/kvm.img  -m 4096 -enable-kvm\
   -net nic,vlan=0,model=virtio,macaddr=0a:98:fc:96:83:01 \
   -net l2tpv3,vlan=0,src=,dst=,srcport=1707,dstport=1706,rxsession=0xffffffff,txsession=0xffffffff,udp,counter


Similarly for gre - we reverse the src, dst and the keys if present (this transport was submitted this summer, you can grab the patches from the QEMU mailing list):

qemu-system-x86_64 -hda /exports/kvm/kvm.img  -m 4096 -enable-kvm\
   -net nic,vlan=0,model=virtio,macaddr=0a:98:fc:96:83:01 \
   -net gre,vlan=0,src=,dst=


Same as GRE - the transport was submitted this summer, you can grab the patches from the QEMU mailing list. The raw transport binds directly to an Ethernet or Ethernet-like interface using raw sockets. The only parameter to specify is the interface to bind to:

qemu-system-x86_64 -hda /exports/kvm/kvm.img  -m 4096 -enable-kvm\
   -net nic,vlan=0,model=virtio,macaddr=0a:98:fc:96:83:01 \
   -net raw,vlan=0,ifname=eth3

It requires the interface to be prepared - it must be in promisc mode and all offloads must be turned off. Especially tso. Checksumming should be left (it was integrated into the most recent driver and transport revisions - after 9th of September 2017).
ethtool -K eth3 gso off 
ethtool -K eth3 tso off 
ethtool -K eth3 rx on
ethtool -K eth3 tx on 
ethtool -K eth3 gro off

  • As there is no ethernet software loopback on Linux you cannot contact the host on which you are running if you are using a raw transport. It is presently intended for the use of one VM per interface. It is preferred (though not mandatory) that the interface is dedicated to the VM - an ethernet pseudowire, f.e. a vlan.
  • GSO, GRO and TSO controls on vlans do not work in most drivers. Turning them on or off via ethtool will return OK, but do nothing. You need to apply ethtool to the master interface in order for these to be turned correctly.

-- AntonIvanov - 01 Oct 2017
Topic revision: r1 - 01 Oct 2017, UnknownUser

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback