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

Laine Stump laine at redhat.com
Mon Aug 6 19:42:33 UTC 2018


On 07/12/2018 03:49 AM, Gianluca Cecchi wrote:
> On Thu, Jul 12, 2018 at 4:46 AM, netsurfed <zhuohaofan at 126.com
> <mailto:zhuohaofan at 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 at 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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
> 




More information about the libvirt-users mailing list