How do I find my optimum MTU setting?

I haven’t been updating my blog for the past few months, But hey I finally got to Marion Island(-47.876404, 37.861019), when I got there I found out the internet was a bit crappy, (1mbps Satellite link). So i was set on a mission to optimize my internet experience – I finally found a way to optimize my browsing experience.

By adjusting the MTU – Maximum Transmission Unit

On Windows:

Step 1: Find your MTU

Open Command Prompt as Administrator, Right-click > Open as Administrator

C:\Windows\system32>netsh interface ipv4 show subinterfaces
You should get something that looks like this
MTU            MediaSenseState          Bytes In             Bytes Out          Interface
——           —————                      ———              ——–                   ————-
1500           1                                            157230870      15309785       Ethernet
4294967295 1                                       0                           430287            Loopback Pseudo-Interface 1
1500             5                                           0                          0                          Wi-Fi
1500            2                                             4432                   16504              Local Area Connection

If you are using Ethernet cable you will be looking for “Local Area Connection” or “Ethernet”. If you are using Wireless you will be looking for “Wireless Network Connection”. The MTU is in the first column.

Step 2: Find out what it should be

In the Command Prompt type:

C:\Windows\system32>ping http://www.cantreachthissite.com -f -l 1472
The host name should be a site you can not reach, -f  marks the packet as one that should not be fragmented the -l 1472 sets the size of the packet (1472 = Ethernet Default MTU – Packet Header, where the Ethernet Default MTU is 1500 and the Packet Header is 28 bytes)

If the packet can’t be sent because it would need to be fragmented you will get something similar to this:

Pinging http://www.cantreachthissite.com [69.43.160.163] with 1472 bytes of data:
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.

Ping statistics for 69.43.160.163:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Keep trying lower packet sizes by 10 (i.e. -l 1460, 1450, 1440, etc.) until you get a successful ping request. Raise your packet sizes by one until you get a “Packet needs to be fragmented but DF set.”. The last successful value plus 28 will be your MTU value.

In my case a packet size of 260 succeeds, so 260 + 28 = 288.

Step 3: Set your MTU

Now you have identified the interface you need to change and the ideal MTU for yourself, now it is time to make the change.

Again Command Prompt with Administrative rights type the following replacing my MTU of 1500 with your own value:

C:\Windows\system32>netsh interface ipv4 set subinterface “Local Area Connection” mtu=288 store=persistent

Or if you are using a Wireless connection:

netsh interface ipv4 set subinterface “Wireless Network Connection” mtu=288 store=persistent

If all has gone well you should have a perfectly working internet connection.

——————————

Also, You can set your MTU permanently on the Registry

Press Windows+R, type regedit the navigate to [HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\[Adapter ID]]

(Find the correct adapter you want to change on your machine, there may be multiple entries depending on the number of adopters you may have)

the right click and create a new REG_DWORD, name it MTU, set the value after that, i use 288

*****************************************************************************************

On Debian Linux(XUbuntu Distro):

Temporary,Until reboot: sudo ip link set eth0 mtu 288

Permanent:

Edit /etc/network/interfaces, enter:

# sudo su

# nano /etc/network/interfaces

Add mtu as follows for required interface:
mtu 288

Save and close the file. Restart the networking, enter:
# /etc/init.d/networking restart

 

Good luck

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s