Header Shadow Image


Linux / Windows: Changing MTU value of a Network Interface Card (NIC)

PROBLEM

Occassionally, the default MTU (Maximum Transmission Value) value of a NIC card can cause you issues including being unable to view/see many internet sites or cause you issues when setting up your network, to the point where you will see communication popup errors and slowdowns.

ROUTER Solution

For routers, please follow the securing the WRT54G wireless router tutorial for information on this.

LINUX Solution

You can set the MTU value on a host following this procedure:

  • Edit the file '/etc/rc.d/rc.local' using either 'kedit', 'pico' or 'vi' or another preferred editor.
  • Add below line(s): echo "Changing the MTU of ETH0" /sbin/ifconfig eth0 mtu 1472
  • Save file '/etc/rc.d/rc.local'
  • Run 'service network restart'

From above, the following command can be used to set the MTU value on the fly but may not preserve settings between reboots:

  • /sbin/ifconfig eth0 mtu 1472

And this will reset your MTU value. 1472 was chosen since it represents a good high without having to go too low sacrificing performance and which could cause transmission delays for your setup. Another option is to edit '/etc/sysconfig/network-scripts/ifcfg-eth0' or 'ifcfg-eth<YOUR ETHERNET CARD>' and add options MTU=1472there for the you need. A lsit of some of ther options you can use in '' are:

  • NAME
  • DEVICE
  • IPADDR
  • NETMASK
  • GATEWAY
  • ONBOOT
  • USERCTL
  • BOOTPROTO
  • NETWORK
  • BROADCAST
  • PERSIST
  • MODEMPORT
  • LINESPEED
  • DEFABORT
  • WVDIALSECT
  • PEERDNS
  • DEFROUTE
  • ESCAPECHARS
  • HARDFLOWCTL
  • PPPOPTIONS
  • PAPNAME
  • REMIP
  • MTU
  • MRU
  • DISCONNECTTIMEOUT
  • RETRYTIMEOUT

For a full explanation of options, please consult the man pages of 'ifconfig'.

WINDOWS Solution

First we need to discover what the MTU value needs to be before we can set it.  For this we can use the Windows DOS prompt.  Follow these steps for determening the MTU value on your system:

  • Click Start then Run..
  •  Type cmd.exe in the text box that appears then click Ok.  A black window should appear.
  •  In this black window type something like: ping -f -l 1400 yourisp.com

NOTE: They key above is the -f flag signalling not to fragment the packets.  The -l indicates the size we are using, initially it will be 1400.

  • As long as you do not get Packet needs to be fragmented but DF set. then continue to increase the value. 
  • To make determening MTU value quicker, you could optionally start at a value of 1464 (1492 – 28) the norm and most common value, then go up one if you still do not see Packet needs to be fragmented but DF set. or down if you see the message when using a buffer size of 1464.
  • What ever number you determine above, add 28 to it.  This is to account for other data a typical data packet is sent with.  That should be your MTU value.

Now that you have your MTU value (For the purpose of the below, I will use 1472 for compatability reasons), for various MS Windows flavours, follow the below procedures for setting the MTU value:

IMPORTANT NOTE: Modifying registry values is a tricky process and we highly recommend you seek the expertise of someone who has done this successfully before, you proceed in a slow and cautious pace and are comfortable making such changes as outlined below.

Windows 2000/XP

  • Click Start then Run…
  • Type regedit.exe in the text box that appears then click Ok.  The registry editor should appear.
  • In registry editor go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{<NETWORK CARD ID>}  It should look similar to DB877E12-84E0-4167-A462-DB2399371A8A and is your Adapter ID.
  • Determine the friendly name from the Adapter ID that corresponds to the network card you want to change by following the below steps:
  1. Browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network in registry editor and look for the Adapter ID you determined above.  For example, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\{DB877E12-84E0-4167-A462-DB2399371A8A}\Connection
  2. Look for the Name key similar to: Name  REG_SZ   My Internet Network Card.  This identified DB877E12-84E0-4167-A462-DB2399371A8A as the card that goes by name My Internet Network Card in Windows that I'm used to.
  3. Alternatively to the above two numbered steps, you can search for DB877E12-84E0-4167-A462-DB2399371A8A in registry editor to come up with the same, but this may be a hit and miss process.
  • If not already present, set a value in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{<NETWORK CARD ID>} similar to the one below:
    MTU     REG_DWORD  0x000005c0 (1472)    
    To set the value, if not already present, right click using the mouse then select New followed by DWORD and fill in the required values.
    To modify a value right click the value with key name MTU and set it's value to the MTU you found earlier (1472).
  • Save and exit registry editor.
  • Use a registry scanning tool such as Registry Mechanic from PCTools to check your registry prior to a reboot.  A reboot may be necessary to take the value into effect.  For more tips on cleaning up your windows installation or speeding MS Windows Tweaking: Performance, Security and Annoyances.

Windows NT 4.0

  • The steps are similar to the Windows 2000/XP steps above with the exception of the key paths.  Alternately use a utility such as DrTCP from http://www.dslreports.com/front/drtcp.html that can assist in doing this.
  • To work with the registry directly, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\{<NETWORK CARD ID>} or HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\{<ADAPTER ID>}\Tcpip\Parameters using the Registry Editor.
  •  The Adapter ID can be matched to it's friendly name by performing a search on the registry within Registry Editor for the Adapter ID similarly to the numbered steps describing the procedure for Windows 2000/XP above.  Subvalues / keys in results will point you to the card name for a given Adapter ID.
  • As before, use a registry scanning tool such as Registry Mechanic from PCTools to check your registry prior to a reboot.  A reboot may be necessary to take the value into effect.

 Hope this helps! 

Leave a Reply

 


     
  Copyright © 2003 - 2013 Tom Kacperski (microdevsys.com). All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License