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@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@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@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@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@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@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
Gianluca Cecchi
2018-Jul-12 07:49 UTC
Re: [libvirt-users] How to set the MTU size of VM interface
On Thu, Jul 12, 2018 at 4:46 AM, netsurfed <zhuohaofan@126.com> wrote:> Dear all: > I start a VM with MTU size 1450, and login VM to check the mtu size, but > this setting didn't work. > >[snip]> However, the actual mtu size of VM is still 1500, as following: > > root@ubuntu-zhf:~# ip addr > >[snip]> 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. >You have to set it inside guest OS. So I presume still in /etc/network/interfaces file for Ubuntu (see also "man interfaces") See also this thread opened by me some days ago and Dominik's answer related to new features and OVN internal dhcp server (if relevant in your scenario) https://lists.ovirt.org/archives/list/users@ovirt.org/thread/PDIZL2GL343GFWV5L6KA4KCPARJ4HWCE/ HIH, Gianluca
Laine Stump
2018-Aug-06 19:42 UTC
Re: [libvirt-users] How to set the MTU size of VM interface
On 07/12/2018 03:49 AM, Gianluca Cecchi wrote:> On Thu, Jul 12, 2018 at 4:46 AM, netsurfed <zhuohaofan@126.com > <mailto:zhuohaofan@126.com>> wrote: > > Dear all: > I start a VM with MTU size 1450, and login VM to check the mtu size, > but this setting didn't work. > > > [snip] > > > However, the actual mtu size of VM is still 1500, as following: > > root@ubuntu-zhf:~# ip addr > > > [snip] > > > 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. > > > > You have to set it inside guest OS.Not necessarily. As far back as libvirt 3.1.0, if the qemu on the host is new enough to support the "host_mtu" commandline option for network devices, the MTU setting from libvirt's XML will be visible in the device capabilities info of the device in the guest, and if the virtio-net driver in the guest is new enough, it will automatically set the MTU of the interface from the device capabilities info.> So I presume still in > /etc/network/interfaces file for Ubuntu (see also "man interfaces")Yes, if the host's qemu or the guest's virtio-net driver are not recent enough, you'll need to set it in both the guest interface config and in the libvirt XML config on the host.> See also this thread opened by me some days ago and Dominik's answer > related to new features and OVN internal dhcp server (if relevant in > your scenario) > https://lists.ovirt.org/archives/list/users@ovirt.org/thread/PDIZL2GL343GFWV5L6KA4KCPARJ4HWCE/ > > HIH, > Gianluca > > > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users >