Mode opératoire
Choix du MTU :
ping -s 1492 -c1 www.google.fr
$ ping -s 1465 -c1 www.google.fr
PING www.google.fr (108.177.96.94) 1465(1493) bytes of data.
From 192.168.1.1 icmp_seq=1 Frag needed and DF set (mtu = 1492)
--- www.google.fr ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
$ ping -s 1464 -c1 www.google.fr
PING www.google.fr (108.177.96.94) 1464(1492) bytes of data.
72 bytes from 108.177.96.94: icmp_seq=1 ttl=45 (truncated)
--- www.google.fr ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 53.556/53.556/53.556/0.000 ms
$ tracepath 8.8.8.8
1?: [LOCALHOST] pmtu 1500
1: 192.168.1.1 1.923ms
1: 192.168.1.1 1.998ms
2: 192.168.1.1 1.609ms pmtu 1492
2: 80.10.126.30 36.486ms
3: 10.123.242.10 36.917ms
4: ae42-0.nistr102.Strasbourg.francetelecom.net 41.976ms asymm 5
5: ae40-0.nistr101.Schiltigheim.francetelecom.net 42.466ms asymm 4
6: 193.252.137.82 45.029ms asymm 5
7: no reply
8: no reply
Note though that the total IP packet size will be 1464+28=1492 bytes since there is 28 bytes of header info. Thus if the packet gets fragmented for payload above 1464, then you should set your MTU=1492. Ping will let you know when it becomes fragmented with something like the following :
Notez cependant que la taille totale du paquet IP sera 1464 + 28 = 1492 octets car il y a 28 octets d’infos d’en-tête. Ainsi, si le paquet est fragmenté pour une taille supérieure à 1464, il faudra définir le MTU = 1492.
Affectation du MTU dans l’interface réseau :
sudo ifconfig <interface> mtu 1492
Sachant que l’on va employer eth0 ou bien enp2s0 ... vérifier via ifconfig.
Plus précisément :
sudo vi /etc/network/interfaces
iface enp2s0 inet static
address 192.168.0.1
network 192.168.0.0
gateway 192.168.0.254
netmask 255.255.255.0
mtu 1492
sudo vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
mtu 1492
RWIN
Depuis le noyau 2.6.7, l’auto-tuning est tel qu’il semble plus sage d’éviter.
Liens divers
How to Change MTU
How to Optimize your Internet Connection using MTU and RWIN
Comprendre et accélérer sa connexion ADSL
Connaître la valeur de MSS / RWIN sous Windows
Accélérer TCP/IP
ubuntu-fr RWIN