How to change MTU value in Linux

How to change MTU value on Linux – To set the best MTU value and optimize Internet speed, follow these easy steps.

Written By Lorenzo Vincent

Updated at May 28th, 2024

If you wish to get more out of your linux OS, then you will also need to set the best MTU value and optimize internet speed. Here's how you can do it.

  • Open Terminal

  • Type the command below and hit enter.

  • If the reply you get is “Frag needed and DF set” then you have to try a lower MTU value. Keep decreasing the value by 10, i.e. 1490, 1480, 1470 until you get a successful reply.
  • Start increasing the MTU value with small increments after you get a successful reply. Eventually, you will arrive on a value on which packets will not fragment, add 28 to that value (IP / ICMP headers).

  • For instance, if you got the last successful reply on 1470, then add 28 to it, 1470+28 = 1498. 
  • This number is your MTU value.
  • Type ifconfig in terminal and hit enter to check your network interface as shown in the picture below: my interface is eth0

  • b- Now type the command below and hit enter to set the MTU value.

  • sudo ifconfig eth0 mtu 1498

Delete