> ## Content Index
> Fetch the complete content index at: https://www.bagz.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Define the MTU size for current network
- URL: https://www.bagz.fr/define-the-mtu-size-for-current-network/
- Published: 2016-03-09T11:05:51.000Z
- Updated: 2016-03-09T11:05:51.000Z
- Author: bgazui
- Tags: Linux, #Migrated-1790668826633, #wp, #wp-post, #Import 2026-09-29 08:00

To limit the fragmentation of packets and optimize your network, it can be necessary to find the best MTU size to set up on your interface. In order to find this best value, you can use a simple *ping* command.

We're first trying with a MTU size of 1500 bytes:

$ ping -M do -s 1500 mysite.com  
PING mysite.com (1.2.3.4) 1500(1528) bytes of data.  
ping: local error: Message too long, mtu=1500  
ping: local error: Message too long, mtu=1500  
ping: local error: Message too long, mtu=1500  

We can clearly see that with the overhead, it's sending 1528 bytes, too long for the MTU size allowed on the network (1500). Message will be fragmented.

We're changing the value to 1472 bytes:

$ ping -M do -s 1472 mysite.com  
PING mysite.com (1.2.3.4) 1472(1500) bytes of data.  
1480 bytes from 1.2.3.4: icmp\_seq=1 ttl=58 time=0.94 ms  
1480 bytes from 1.2.3.4: icmp\_seq=2 ttl=58 time=0.62 ms  
1480 bytes from 1.2.3.4: icmp\_seq=3 ttl=58 time=0.53 ms  

Right now, we can see that packets are not fragmented anymore, exactly what we were expected!

On most of Linux distributions, MTU size can be set with this command:

ifconfig eth0 mtu 1472 up  

You can check the results with the *ip addr show* command:

$ ip addr show  
\[...\]  
2: eth0: <no-carrier,broadcast,multicast,up> mtu 1492 qdisc fq\_codel state DOWN group default qlen 1000  
 link/ether 12:34:56:78:90:12 brd ff:ff:ff:ff:ff:ff  
\[...\]  
</no-carrier,broadcast,multicast,up>