码迷,mamicode.com
首页 > 其他好文 > 详细

SR-IOV虚拟机的MTU与物理网卡的MTU

时间:2018-08-30 23:35:49      阅读:373      评论:0      收藏:0      [点我收藏+]

标签:cas   for   packet   font   group   ack   oss   eve   errors   

在进行SR-IOV虚拟机MTU方面的测试时,出现如下情况:

1)物理网卡PF的MTU值是4000:

root@compute-1:~# 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:

root@test-vm1:~# 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网关结果如下:

root@test-vm1:~# 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
root@test-vm1-5:~# 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,与物理网卡的相同:

root@test-vm1:~# 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

root@test-vm1:~# 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

 

root@test-vm1-5:~# 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(大于物理网卡):

root@test-vm1-5:~# 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
root@test-vm1-5:~# 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
root@test-vm1-5:~# 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

标签:cas   for   packet   font   group   ack   oss   eve   errors   

原文地址:https://www.cnblogs.com/bjtime/p/9563252.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!