brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ip link set mtu changes the MTU of a Linux interface for a quick test

Linux
~/tips/tip-linux-ip-link-set-mtu

ip link set dev eth0 mtu 1400

Try a smaller or larger MTU on one interface without editing any network config.

When large transfers stall but small requests work, the MTU is a usual suspect, especially over VPNs and tunnels. Before you change it in a config file, you can try the new value live.

ip link show dev eth0
ip link set dev eth0 mtu 1400

The first command prints the current value after mtu on the first line. The second sets a new one right away, no restart of anything needed. If the stalls disappear at 1400 and come back at 1500, you know where the problem lives.

Going up works the same way, for example mtu 9000 for jumbo frames on a storage network. That only helps when the switch and the machine on the other end use the same size; one device in the path with a smaller MTU and the big frames get dropped. Not every network card or driver accepts every value either, and ip tells you so with an Invalid argument error.

To find the right number instead of guessing, I’d first check which packet size still gets through with ping -M do, then set the MTU to match.

A value set this way is gone after a reboot, and NetworkManager may put its own value back when the connection comes up again. Once you know the number that works, set it in netplan, NetworkManager or systemd-networkd. Be careful on a remote machine: a wrong MTU on the interface you are connected through can freeze your SSH session.

Further reading: ip-link(8) manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link