Fixing Slow VirtIO Network Performance in Gentoo Linux

tl;dr: It’s the same as with other distros but with a very small twist

Note: These instructions pertain to Gentoo as the hypervisor. They apply to any OS as the guest.

If you’re finding a virtual machine’s network (over VirtIO/netkvm) being limited to roughly 8mbit/s, the accepted fix is to, in the hypervisor, disable certain offloading options for the bridge interface…

~# ethtool -K br0 tso off gro off

In Gentoo, if you emerge sys-apps/ethtool, and then attempt to turn off those options using the tool, you will be presented with errors.

~# ethtool -K br0 tso off gro off
Cannot get device udp-fragmentation-offload settings: Operation not supported
Cannot get device udp-fragmentation-offload settings: Operation not supported

This is because an older version of ethtool is trying to read information relating to an option that has since been removed from the Kernel. The version of ethtool that Portage will normally install is version 4.8, which was released in late 2016. ethtool has since been patched to remove the deprecated function.

The fix is simple; Instruct Portage to use the latest “testing” version of ethtool, by adding this line to your package keywords:

=sys-apps/ethtool-4.15 ~amd64

Emerge ethtool again, and run the above command again. The shackles will immediately be removed from the guest, no restart required.

Leave a Reply

Your email address will not be published. Required fields are marked *