[libvirt-users] How to set the MTU size of VM interface

netsurfed zhuohaofan at 126.com
Thu Jul 12 02:46:07 UTC 2018


Dear all:
I start a VM with MTU size 1450, and login VM to check the mtu size, but this setting didn't work. 
The VM xml is like this:
<interface type='bridge'>
      <mac address='52:54:00:54:14:f8'/>
      <source bridge='ovsbr1'/>
      <virtualport type='openvswitch'>
        <parameters interfaceid='a42e5b42-09db-4cfa-b198-d2ce62843378'/>
      </virtualport>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <mtu size='1450'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>


However, the actual mtu size of VM is still 1500, as following:
root at ubuntu-zhf:~# ip addr
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:54:14:f8 brd ff:ff:ff:ff:ff:ff
The MTU size of both ovs bridge and vnet are 1450 in my hypervisor:
root at ubuntu-191:~# ip addr show ovsbr1
16: ovsbr1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc noqueue state UNKNOWN group default qlen 1
    link/ether 12:01:7b:5b:85:49 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::1001:7bff:fe5b:8549/64 scope link 
       valid_lft forever preferred_lft forever
root at ubuntu-191:~# ip addr show vnet0
22: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1450 qdisc pfifo_fast master ovs-system state UNKNOWN group default qlen 1000
    link/ether fe:54:00:54:14:f8 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc54:ff:fe54:14f8/64 scope link 
       valid_lft forever preferred_lft forever




I use ovs to create vxlan networks and add VMs to the ovs bridge. Because of the limitations of vxlan, I need to set the mtu of vm to 1450.
How to set the MTU of VM?  Thanks.
Below some information about my hypervisor:

root at ubuntu-192:~# virsh -V
Virsh command line tool of libvirt 3.4.0
See web site at http://libvirt.org/

Compiled with support for:
 Hypervisors: QEMU/KVM LXC UML OpenVZ VMware VirtualBox Test
 Networking: Remote Network Bridging Interface udev Nwfilter VirtualPort
 Storage: Dir Filesystem SCSI Multipath iSCSI LVM
 Miscellaneous: Daemon Nodedev SELinux Secrets Debug Modular
root at ubuntu-192:~# qemu-x86_64 --version
qemu-x86_64 version 2.9.0
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

root at ubuntu-192:~# uname -a
Linux ubuntu-192 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20180712/044d91f3/attachment.htm>


More information about the libvirt-users mailing list