How to Change the MTU Value for a Virtual Machine

Written by

in

1. Overview

MTU (Maximum Transmission Unit) is the largest packet size, measured in bytes, that a network interface can send in a single frame without fragmentation.

The default MTU on most Ethernet networks is 1500 bytes.

A larger MTU, such as 9000 bytes (Jumbo Frames), is commonly used in high-performance environments, including storage networks, virtualization platforms, and cloud infrastructure.

2. Why Use MTU 9000?

Using an MTU of 9000 allows more data to be transmitted in each packet, reducing the total number of packets required.

Benefits include:

  • Lower CPU usage due to fewer packets being processed.
  • Higher network throughput.
  • Improved performance for data-intensive workloads such as backups, virtual machine migrations, and databases.

3. Why Applications May Not Work with MTU 9000

For MTU 9000 to work correctly, every device in the network path must support Jumbo Frames.

If any device, such as a switch, router, firewall, or VPN, only supports an MTU of 1500, larger packets may be dropped or fragmented.

Example:
Server A (MTU 9000) → Switch (MTU 9000) → Router/VPN (MTU 1500) → Server B

In this case, the router cannot process 9000-byte packets, which may result in:

  • Connection failures
  • Packet loss
  • Network timeouts
  • Application issues, especially with databases, SSH, APIs, or web applications

4. Why Use MTU 1500?

  • An MTU of 1500 is the standard value supported by virtually all network devices.
  • If an application works with MTU 1500 but fails with MTU 9000, it usually indicates an MTU mismatch somewhere in the network path.
  • Using MTU 1500 provides stable and reliable connectivity, although it may offer slightly lower performance than Jumbo Frames.

5. Check the Current Network Interface

Before changing the MTU, identify the active network interface.

Run either of the following commands:

Bash
ip link show

or

Bash
nmcli device status

Example output:

2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9000 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:ab:cd:ef brd ff:ff:ff:ff:ff:ff

In this example:

  • Interface: enp1s0
  • Current MTU: 9000

6. Change MTU Permanently on Ubuntu 24.x

Step 1: Back Up the Netplan Configuration

Bash
sudo cp /etc/netplan/50-cloud-init.yaml /etc/netplan/50-cloud-init.yaml.bak

Step 2: Edit the Netplan Configuration

Open the configuration file:

Bash
sudo nano /etc/netplan/50-cloud-init.yaml

Update the interface configuration to include the required MTU value:

Bash
network:
version: 2
ethernets:
enp1s0:
dhcp4: true
dhcp6: true
optional: true
mtu: 1500

Step 3: Apply the Changes

Bash
sudo netplan apply

Step 4: Verify the MTU

Bash
ip link show enp1s0 | grep mtu

7. Change MTU Permanently on AlmaLinux

Step 1: Back Up the NetworkManager Connection Profile

View the active connection:

Bash
nmcli connection show –active

Create a backup of the connection profile:

Bash
sudo cp “/etc/NetworkManager/system-connections/<profile-name>.nmconnection” “/etc/NetworkManager/system-connections/<profile-name>.nmconnection.bak”

Step 2: Configure the MTU

Set the MTU value permanently:

Bash
sudo nmcli connection modify <profile-name> 802-3-ethernet.mtu 1500

Step 3: Restart the Network Connection

Restart the connection:

Bash
sudo nmcli connection down <profile-name> && sudo nmcli connection up <profile-name>

Or restart the NetworkManager service:

Bash
sudo systemctl restart NetworkManager

Step 4: Verify the MTU

Bash
ip link show <interface-name> | grep mtu

8. Temporary MTU Change (Ubuntu and AlmaLinux)

To test a different MTU without making a permanent change, run:

Bash
sudo ip link set dev <interface-name> mtu 1500

This change is temporary and will be lost after the system is restarted.

9. Change the MTU on Windows Server Using PowerShell

Purpose

This procedure explains how to view and modify the MTU on a Windows Server using PowerShell.

Prerequisites

Before making changes:

  • Ensure you have administrative privileges.
  • Identify the network interface you want to modify.

Step 1: Check the Current MTU

Open PowerShell as Administrator.

Run:

PowerShell
Get-NetIPInterface

Review the InterfaceAlias and NlMtu values for the network interface.

Example:

ifIndex InterfaceAlias AddressFamily NlMtu(Bytes)
——- ————– ————- ————
5 Ethernet Instance 0 IPv4 9000
5 Ethernet Instance 0 IPv6 1500

Step 2: Change the MTU

To change the MTU for IPv4:

Bash
Set-NetIPInterface -InterfaceAlias “Ethernet Instance 0” -NlMtu 1500

To change the MTU for IPv6:

Bash
Set-NetIPInterface -InterfaceAlias “Ethernet Instance 0” -AddressFamily IPv6 -NlMtu 1500

Step 3: Verify the MTU

Run:

Bash
Get-NetIPInterface | Select-Object InterfaceAlias, AddressFamily, NlMtu

Example output:

InterfaceAlias AddressFamily NlMtu
————– ————- —–
Ethernet Instance 0 IPv4 1500
Ethernet Instance 0 IPv6 1500

Step 4: Restart the Network Adapter (Optional)

To apply the changes immediately:

Bash
Restart-NetAdapter -Name “Ethernet Instance 0”

Step 5: Verify the MTU is Persistent

Confirm that the MTU value has been saved to the persistent configuration:

Bash
Get-NetIPInterface -InterfaceAlias “Ethernet Instance 0” -PolicyStore PersistentStore

This verifies that the MTU configuration will remain in effect after the server is restarted.