How to set MTU size

Prev Next

WHAT TO EXPECT

In this article, users will learn how to change the MTU size of a given VM.

In some cases, the MTU Size of the multicast group may exceed the default limit of the OS. It can also happen that, in some circumstances, the user may need a small MTU size to send smaller packages. This article will explain how to increase the MTU size if this should occur.

To know if the MTU size has been exceeded, Wireshark or tcpdump can be used.  Below is an example from Wireshark.

MTU Size_discovery

NOTE

In this example, the UDP length error shows it is exceeding the Length.

Change MTU size on Linux

  1. First, check the current MTU size by running the following command:

    ifconfig | grep mtu

    Example:

    $ ifconfig | grep mtu
    enP43852s1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
    enP4589s2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

    As can be seen, the MTU size of eth1 is 1500.

  2. To change the MTU size to, for example, 2000, use the command below:

    sudo ifconfig eth1 mtu 2000 up
  3. Validate the change is set by running again:

    ifconfig | grep mtu

    Example:

    $ ifconfig | grep mtu
    enP43852s1: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500
    enP4589s2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 2000
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 2000
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

    As can be seen, the MTU size of eth1 is now 2000.

Change MTU size on Windows

  1. Check the current MTU size by running:

    netsh interface ipv4 show subinterfaces

    That will show a list of network interfaces with their MTU size:

    PS C:\Windows\System32> netsh interface ipv4 show subinterfaces
    
           MTU  MediaSenseState      Bytes In     Bytes Out  Interface
    ----------  ---------------  ------------  ------------  -------------
    4294967295                1             0        444816  Loopback Pseudo-Interface 1
          1500                5             0          3214  Local Area Connection* 1
          1500                5             0             0  Local Area Connection* 2

    As can be seen, the MTU size of the local adapters is 1500.

  2. Set the MTU Size (in this case, to 2000) using the following commands:

    netsh interface ipv4 set subinterface "Interface Name" mtu=2000 store=persistent

    Where “Interface Name” is the Ethernet adaptor to be set. For example, users can get the list of names with ipconfig:
    MTU Size_windows set 1

    1. If the following error appears:

      PS C:\Windows\System32> netsh interface ipv4>set subinterface "Ethernet 2" mtu=2000 store=persistent
      The parameter is incorrect.

      Then follow these steps:

      1. Go to the Network connection → “Control Panel\Network and Internet\Network Connections”
        MTU Size_windows set 2

      2. Right-click on the Ethernet Adaptor that the traffic is expected and select Properties.
        MTU Size_windows set 3

      3. Select “Configure”
        MTU Size_windows set 4

      4. Go to Advanced, look for and select "Jumbo Packet":
        MTU Size_windows set 5

      5. Select the desired size, for example"4088 Bytes", then select "OK".
        MTU Size_windows set 6

      6. Re-run step 2 to set MTU size.

      7. If needed, reboot the VM.

      8. Re-run step 1 to validate the MTU size is correct