1. Home
  2. Knowledge Base
  3. Support
  4. How to change the mtu value for the virtual machine.

How to change the mtu value for the virtual machine.


🔹 What is MTU?

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

  • Default on most Ethernet networks = 1500 bytes
  • “Jumbo frames” = 9000 bytes (commonly used in high-performance networks, storage, HPC, or cloud setups)

  • With larger MTU (e.g., 9000), fewer packets are needed to send the same amount of data.
  • Benefits:
    • Less CPU overhead (fewer packets to process).
    • Higher throughput.
    • Better performance for data-heavy applications like backups, VM migrations, or databases.

So some environments recommend MTU 9000 for performance.


🔹 Why an application may fail with MTU 9000?

If all devices in the path (server NICs, switches, routers, firewalls, VPN, etc.) do not support 9000, then packets can get dropped or fragmented.

Example:

  • Server A (MTU 9000) → Switch (supports 9000) → Router/VPN (supports only 1500) → Server B
  • When Server A sends a 9000-byte packet, the router cannot handle it → connection stalls or drops.

Applications sensitive to packet loss or retransmission (like database connections, SSH, APIs, or certain web apps) may break.


🔹 Why set MTU 1500 then?

  • 1500 is the safe default: every device on the internet supports it.
  • If an application fails at MTU 9000 but works at 1500, it means there’s a path MTU mismatch somewhere.
  • Setting 1500 ensures stable connectivity at the cost of some performance.

How to Permanently Change the MTU in Ubuntu 24.x and AlmaLinux

1. Check the Current Active Network Port

Before modifying MTU, you must identify the active network interface.

Run either of the following commands (works in both Ubuntu & AlmaLinux):

ip link show

or

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

Here, the active port is enp1s0 and the MTU is currently set to 9000.


2. Steps for Ubuntu 24.x (Netplan)

Step 1: Backup the Netplan Configuration

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

Step 2: Edit the Netplan Configuration

Open the YAML file:

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

Modify to include mtu: 1500 under your interface:

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

Step 3: Apply the Changes

sudo netplan apply

Step 4: Verify MTU

ip link show enp1s0 | grep mtu

3. Steps for AlmaLinux (NetworkManager)

Step 1: Backup the Connection Profile

NetworkManager stores interface configs under /etc/NetworkManager/system-connections/.
First, find your active profile:

nmcli connection show --active

Backup the config file:

sudo cp "/etc/NetworkManager/system-connections/<profile-name>.nmconnection" "/etc/NetworkManager/system-connections/<profile-name>.nmconnection.bak"

Step 2: Set MTU Permanently

Run:

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

Step 3: Restart NetworkManager

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

or

sudo systemctl restart NetworkManager

Step 4: Verify MTU

ip link show <interface-name> | grep mtu

4. Temporary Change (Both OS)

If you just want to test MTU (not permanent), run:

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

This change will be lost after reboot.


✅ Now you have MTU permanently changed to 1500 in both Ubuntu 24.x and AlmaLinux.

How to Change the MTU on Windows Server Using PowerShell

Purpose

This article explains how to view and modify the MTU (Maximum Transmission Unit) on Windows Server using PowerShell.


Prerequisites

  • Administrative privileges on the server.
  • Knowledge of the network interface you want to modify.

Step 1: Check Current MTU

  1. Open PowerShell as Administrator.
  2. Run the following command to list all network interfaces and their MTU values: Get-NetIPInterface
  3. Note the InterfaceAlias and NlMtu value of the interface you want to modify.

Example Output:

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

Step 2: Change the MTU

  1. To set a new MTU (e.g., 1500) for IPv4: Set-NetIPInterface -InterfaceAlias "Ethernet Instance 0" -NlMtu 1500
  2. To set MTU for IPv6: Set-NetIPInterface -InterfaceAlias "Ethernet Instance 0" -AddressFamily IPv6 -NlMtu 1500

Step 3: Verify the Change

Run:

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

Expected Output Example:

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

Step 4: Optional – Restart the Adapter

To immediately apply changes:

Restart-NetAdapter -Name "Ethernet Instance 0"

Step 5: Verify MTU Persistence

Confirm that the MTU value is stored in PersistentStore. Changes made using Set-NetIPInterface are persistent across reboots.

Run: Get-NetIPInterface -InterfaceAlias "Ethernet Instance 0" -PolicyStore PersistentStore

Was this article helpful?

Related Articles

This is a staging environment