SR-IOV虚拟机的MTU与物理网卡的MTU
Posted bjtime
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SR-IOV虚拟机的MTU与物理网卡的MTU相关的知识,希望对你有一定的参考价值。
在进行SR-IOV虚拟机MTU方面的测试时,出现如下情况:
1)物理网卡PF的MTU值是4000:
[email protected]:~# ip l|more
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
......................
5: eth3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 4000 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 3c:f5:cc:27:30:ef brd ff:ff:ff:ff:ff:ff
vf 0 MAC da:ab:1c:b4:a9:bf, spoof checking on, link-state auto
vf 1 MAC 06:f1:54:8e:2a:31, spoof checking on, link-state auto
2)SR-IOV虚拟机的MTU设置为3000:
[email protected]:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 3000 qdisc mq state UP group default qlen 1000
link/ether fa:16:3e:e6:75:c8 brd ff:ff:ff:ff:ff:ff
inet 10.3.11.5/24 brd 10.3.11.255 scope global ens4
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fee6:75c8/64 scope link
valid_lft forever preferred_lft forever
虚拟机ping网关结果如下:
[email protected]:~# ping -s 2972 -M do 10.3.11.1
PING 10.3.11.1 (10.3.11.1) 2972(3000) bytes of data.
2980 bytes from 10.3.11.1: icmp_seq=1 ttl=254 time=0.563 ms
2980 bytes from 10.3.11.1: icmp_seq=2 ttl=254 time=0.645 ms
2980 bytes from 10.3.11.1: icmp_seq=3 ttl=254 time=0.528 ms
^C
--- 10.3.11.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.528/0.578/0.645/0.056 ms
[email protected]:~# ping -s 2973 -M do 10.3.11.1
PING 10.3.11.1 (10.3.11.1) 2973(3001) bytes of data.
ping: local error: Message too long, mtu=3000
ping: local error: Message too long, mtu=3000
ping: local error: Message too long, mtu=3000
^C
--- 10.3.11.1 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2014ms
==>报文长度受限于SR-IOV虚拟机的MTU值
3)修改SR-IOV虚拟机的MTU值为4000,与物理网卡的相同:
[email protected]:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 4000 qdisc mq state UP group default qlen 1000
link/ether fa:16:3e:e6:75:c8 brd ff:ff:ff:ff:ff:ff
inet 10.3.11.5/24 brd 10.3.11.255 scope global ens4
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fee6:75c8/64 scope link
valid_lft forever preferred_lft forever
[email protected]:~# ping -s 3973 -M do 10.3.11.1
PING 10.3.11.1 (10.3.11.1) 3973(4001) bytes of data.
ping: local error: Message too long, mtu=4000
ping: local error: Message too long, mtu=4000
^C
--- 10.3.11.1 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 1000ms
[email protected]:~# ping -s 3972 -M do 10.3.11.1
PING 10.3.11.1 (10.3.11.1) 3972(4000) bytes of data.
3980 bytes from 10.3.11.1: icmp_seq=1 ttl=254 time=0.562 ms
3980 bytes from 10.3.11.1: icmp_seq=2 ttl=254 time=0.604 ms
3980 bytes from 10.3.11.1: icmp_seq=3 ttl=254 time=0.703 ms
^C
--- 10.3.11.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
==>报文长度受限于MTU=4000
4)修改SR-IOV虚拟机的MTU值为5000(大于物理网卡):
[email protected]:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 5000 qdisc mq state UP group default qlen 1000
link/ether fa:16:3e:e6:75:c8 brd ff:ff:ff:ff:ff:ff
inet 10.3.11.5/24 brd 10.3.11.255 scope global ens4
valid_lft forever preferred_lft forever
inet6 fe80::f816:3eff:fee6:75c8/64 scope link
valid_lft forever preferred_lft forever
[email protected]:~# ping -s 4972 -M do 10.3.11.1
PING 10.3.11.1 (10.3.11.1) 4972(5000) bytes of data.
4980 bytes from 10.3.11.1: icmp_seq=1 ttl=254 time=0.531 ms
4980 bytes from 10.3.11.1: icmp_seq=2 ttl=254 time=0.554 ms
4980 bytes from 10.3.11.1: icmp_seq=3 ttl=254 time=0.542 ms
^C
--- 10.3.11.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.531/0.542/0.554/0.021 ms
[email protected]:~# ping -s 4973 -M do 10.3.11.1
PING 10.3.11.1 (10.3.11.1) 4973(5001) bytes of data.
ping: local error: Message too long, mtu=5000
ping: local error: Message too long, mtu=5000
^C
--- 10.3.11.1 ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 1007ms
==>当vNIC的MTU大于物理网卡的MTU时,报文长度仍然受限于SR-IOV虚拟机的MTU值;
也就是说在SR-IOV场景中,物理网卡的MTU限制并不起作用。
哪位专家能解释一下?
以上是关于SR-IOV虚拟机的MTU与物理网卡的MTU的主要内容,如果未能解决你的问题,请参考以下文章
SR-IOV(Single Root I/O Virtualization):将PCIe共享给虚拟机的标准