Let me ask you if you've ever had a
VPS speed up a moment and then slow down the next. I've had that happen many times; and when it does, it's often something almost no one thinks about. An
MTU mismatch. Let's break this down in the basic format.
What MTU Really Is
MTU (Maximum Transmission Unit) is the largest amount of data your
VPS can send in a single packet. I like to try and think about it like pushing boxes through a door; if the boxes are too big they get stuck; if they are too small, you have to make more trips and waste time. Your network works the same way.
When your VPS attempts to send packets that the network cannot support, things break; ever seen a website load half way and then freeze? Yep, that's
MTUs doing their standard MTU thing.
What Occurs When MTU is Not Consistent
When
MTU is inconsistent, you have to deal with irritating problems that give you the impression that something is broken, although it is just a small number.
For example, you might experience:
- Slow service or laggy network
- Dropped connections
- SSH disconnecting you
- Webpages timing out
- Issues with the VPN
I have lost track of how many times I have interrogated my
VPS provider, only to realize that the actual issue was the MTU.
Why MTU Issues Happen
You may be asking, "Why does MTU even change?" Good question.
Here are the common reasons:
- Your VPS provider is using 1500 MTU, but you are using a lower MTU
- A proxy or VPN is adding overhead that reduces MTU
- The cloud provider uses tunnels that shrink the MTU
- Firewalls block ICMP and therefore cannot auto correct MTU
Basically, all the systems on the path are using a different packet size.
How I Typically Resolve MTU Issues
Whenever my VPS feels weird, MTU is the first thing I will check.
1. I Test for the Correct MTU
I run:
ping -M do -s 1472 google.com
If it fails, I decrement the size until it works.
2. I Set My New MTU
Most of the cloud setups function just fine with a
1400-1450 MTU, particularly when using
VPN or
Docker.
3. I Restart and Retest
When I set my new
MTU, within a minute everything has usually begun work again.
When Do You Want to Check MTU?
Here is a fun tip:
- If your VPS will load certain sites but not others...
- If your SSH session drops the connection even though you have a stable connection...
- If the network feels "choppy"...
Think MTU first. It's surprising how often it leads to resolution of the issue.