大网数据广告活动
服务器运维问答

Get link speed of an virtio-net network adapter

· 52CE 我爱测

I have an linux vm running on kvm with virtio-net, and I want to check the link speed. How can I do that? What I tried so far: # ethtool eth0 Settings for eth0: Link detected: yes It seems that ethtool does not support virtio-net…

问题原文

原帖链接 · ddio · CC BY-SA 3.0

I have an linux vm running on kvm with virtio-net, and I want to check the link speed. How can I do that?

What I tried so far:

# ethtool eth0
Settings for eth0:
Link detected: yes

It seems that ethtool does not support virtio-net(yet?) I have the version 3.16-1 from debian jessie, does ethtool support it in newer version? It seams version 6 is the newest one.

 # cat /sys/class/net/eth0/speed
cat: /sys/class/net/eth0/speed: Invalid argument


 # lspci | grep -iE --color 'network|ethernet'
00:12.0 Ethernet controller: Red Hat, Inc Virtio network device

  # lshw -class network
  *-network
       description: Ethernet interface
       product: Virtio network device
       vendor: Red Hat, Inc
       physical id: 12
       bus info: pci@0000:00:12.0
       logical name: eth0
       version: 00
       serial: 4e:ff:a8:bf:61:12
       width: 32 bits
       clock: 33MHz
       capabilities: msix bus_master cap_list rom ethernet physical
       configuration: broadcast=yes driver=virtio_net driverversion=1.0.0 ip=172.30.2.152 latency=0 link=yes multicast=yes
       resources: irq:10 ioport:c080(size=32) memory:febf2000-febf2fff memory:febe0000-febeffff

I found one link that describes the problem in the redhat kb, but unfortunately I do not have an subscription to read it.

已采纳解答

原帖链接 · Nath · CC BY-SA 4.0

Virtio is a para-virtualized driver, which means the OS and driver are aware that it's not a physical Device. The driver is really an API between the guest and the hypervisor so it's speed is totally disconnected from any physical device or Ethernet standard.

This is a good thing, as this is faster than the hypervisor pretending to be a physical device and applying an arbitrary "link speed" concept to flow.

The VM just dumps frames onto a bus and it's the host's job to deal with the physical devices; no need for the VM to know or care what the link speed of the hosts physical devices are.

One of the advantages of this is that when packets are moving between 2 VMs on the same host they can send packets as fast as the host's CPU can move them from one set of memory to another, setting a "linkspeed" here just puts in an unneeded speed limit.

This also allows the host to do adaptor teaming and spread traffic across multiple links without every VM needing to be explicitly configured to get the full bandwidth of the setup.

If you want to know how fast you can actually transfer data from your VM to another location you need to do actual throughput tests with tools like iperf.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2015-11-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。