Security, PKI, sys and network admins

How to change the MTU of a network interface with ifconfig in Linux

Your network interface might not act properly by not having an speed unknown value for example and this is sometimes caused by an abnormal MTU value for your network interface. You can change that using the ifconfig command.

  • on Ubuntu 16.04/18.04/20.04 LTS.

So, open your terminal and let’s start.

  1. Check the current MTU value of your network interface (in this article, I’ll use o-nw as my network interface) using the netstat command:
netstat -i

Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 9134 5203415 0 0 0 5900271 0 0 0 BMRU
eth1 9134 199269 0 0 0 157802 0 0 0 BMRU
lo 65536 2357923 0 0 0 2357923 0 0 0 LRU
o-nw 1500 130648 0 0 0 39375 6403 0 0 BMRU
vxlan_sy 65000 137063 0 0 0 79713 0 0 0 BMRU

The output of the netstat command

As you might notice from the above ouput, the netstat command showed the current MTU values for every existent network interface on the server. And if you take a closer look, you’ll notice the o-nw interface is the only one with a different MTU value compared to the other 2 network interfaces (eth0 and eth1). So, that will be the purpose of this article: to change the MTU value of the o-nw network interface to 9134, from 1500.

  1. Change the MTU value of the network interface using the ifconfig command:
ifconfig o-nw mtu 9134
  1. Verify the new MTU value of your network interface using the netstat command:
netstat -i

Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 9134 5206337 0 0 0 5903414 0 0 0 BMRU
eth1 9134 199393 0 0 0 157893 0 0 0 BMRU
lo 65536 2359314 0 0 0 2359314 0 0 0 LRU
o-nw 9134 130726 0 0 0 39398 6406 0 0 BMRU
vxlan_sy 65000 137144 0 0 0 79762 0 0 0 BMRU

The output of the netstat command

Leave a Reply

Your email address will not be published. Required fields are marked *