How to change MTU in Linux

How to change your interface MTU in Linux

Here is how to change your interface MTU size in Linux os. My example below is from an Ubuntu VM.

  1. Open the Terminal program to get a command line prompt.
  2.  Type the command ifconfig into terminal to see current interface info. You may see something like eth0 for the interface. But in my example from a VM below I am seeing enp0s3. ( You may be asking what is enp0s3? This is a part of a standard for Predictable Network Interface Names. (You can find more info on that here  if your interested or more detail at the bottom of this post. )
  3. Chane MTU size in Linux ifconfig command
  4.  To change the MTU size to 1518 in my example, I am going to use the command sudo ifconfig enp0s3 mtu 1518 , this will change the MTU size to 1518 on the specific interface I identify in the command (for me this is interface enp0s3).
  5.  Here you can see the MTU size has now been changed to 1518.

using ifconfig to change MTU size in ubuntu.

 

 

Why is the interface called enp0s3 ?

Basically it breaks down to “en” Ethernet “p <bus> s <slot>” which is how my interface got named enp0s3.

You can find the full naming information in the comments section HERE. But here is short summary of it.

Two character prefixes based on the type of interface:
en — Ethernet
ib — InfiniBand
sl — serial line IP (slip)
wl — wlan
ww — wwan
Type of names:
b<number>                         — BCMA bus core number
c<bus_id>                             — bus id of a grouped CCW or CCW device,
with all leading zeros stripped [s390]
o<index>[n<phys_port_name>|d<dev_port>]
— on-board device index number
s<slot>[f<function>][n<phys_port_name>|d<dev_port>]
— hotplug slot index number
x<MAC>                               — MAC address
[P<domain>]p<bus>s<slot>[f<function>][n<phys_port_name>|d<dev_port>]
— PCI geographical location
[P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
— USB port number chain
v<slot>                               – VIO slot number (IBM PowerVM)
a<vendor><model>i<instance>           — Platform bus ACPI instance id
i<addr>n<phys_port_name>        — Netdevsim bus address and port name
Changing MTU in Windows

If you would like to see how to change the MTU size in windows, you can see that in this post here.