MTU Size Matters
Published Nov 21 2019 07:06 PM 35.1K Views
Microsoft


The Problem

"The internet is down!"  This is how I am greeted after a long day at work.  My teenage son, who plays virtually every game known to mankind, could not join the majority of game servers for his favorite game.  There were a handful that connected with no problems but naturally those were not the ones that his friends were on.  As you can imagine, a travesty of justice of this magnitude does not sit well with a teenager who is being deprived of the "highly educational" banter of his friends as they defend the world from zombies or mindlessly run goats around a city.  Don't get me wrong, I am thankful for their service and realize that we would be up to our eyeballs in zombie goats without them.  

 

Troubleshooting

After checking all the usual suspects in troubleshooting (permissions issues, UAC, local and network firewall, proxy) I was drawing a blank.  I was not surprised by that since most issues at those levels are binary, either blocking or not with no in-between.  I finally decided to run a network capture to see if I could get any information that I was not seeing in any of the the computer's logs. We ran a network capture of the session connection in both a good connection to an online server, and a failed connection attempt.  Keep in mind that in most versions of Windows (7 & 2008 R2 & later), you can run a capture from the command line without installing any additional software by running: netsh trace start capture=yes tracefile=c:\temp\YourTraceFile.etl" To stop the trace after you have captured any failures or activity of interest, run the following command: netsh trace stop  

 

Gratuitous (Free) Product Plug

To view the network capture, I loaded the them into Microsoft Message Analyzer, which to this day, I am amazed at how few people know about and use this program.  It is the next generation of analysis tool, replacing NetMon and is much more than a network protocol analyzer.  I highly recommend checking it out and getting to know it's capabilities. It's free, it's awesome, download it! https://www.microsoft.com/en-us/download/details.aspx?id=44226
 
By comparing the two captures side-by-side, I was able to find an ICMP packet that looked out of place and was only present in the bad capture that was the key to solving this problem.  As with any network capture, firewall/proxy log analysis, or event log analysis, the real skill is in paring down the information to eliminate the "noise".  Take some time and learn the filtering syntax. 
 
In this case, the filter that we want to show packets that would indicate a fragmentation issue would be: icmp.type==3 and icmp.code==4 As shown in the image below, the summary field contained a warning "The datagram is too big".  Also note that the packet length was only 576, which seemed excessively small.  Normally, on a broadband connection or LAN, you would see something in the neighborhood of 1500 (1472 when you factor in the IP & ICMP headers of 20 & 8 bytes respectively).
 
MTU1.jpg
 
MTU or Maximum Transmission Unit is a setting that basically tells your computer how much data to put in a packet to send over the network.  Think about it like the difference between taxi cabs and buses in a crowded city.  You can put a small number of people in a taxi (and have more of them running around) or you can have fewer buses that carry a larger number of passengers.  The downside of a smaller MTU is that you have a certain amount data of consumed with packet headers and processing overhead dealing with more small packets.  Larger MTU size results in fewer, large packets hitting the network so its more efficient.  The downside is that it can tie up a slow link while transmitting the larger packets and, if you have communication issues that require the packets to be re-transmitted, a larger MTU size would be costly since the entire larger packet has to be re-sent.  In most cases you don't have to mess with these settings, especially with the high bandwidth world we live in. You would barely notice the occasional re-transmissions or the added overhead of processing many smaller packets.  Networks for the most part have a mechanism called Path MTU Discovery that will automatically examine the path that a packet will traverse and negotiate the largest MTU that the path will support.

 

The Diagnosis and Fix

In this particular case, there was a perfect storm situation where my ISP was pushing the MTU size at 576 in the DHCP negotiation and my firewall was preferring that setting over the specified MTU size for the connection.  I ended up manually configuring the firewall to ignore the MTU setting from the DHCP negotiation. A quick reset of the firewall to ensure that it went through a full re-negotiation of DHCP, and we were up and running with the larger MTU size. And guess what, my son's PC can now connect to the game servers! And he is not here to see this glorious moment! My configuration at home may be more complicated than most since I have a firewall and proxy server in the mix.  If you need to set the MTU size on the local computer that you are working on, you can use the commands below to determine your MTU size and set the MTU, once you know the maximum size.
===============================================
PROCESS TO DETERMINE MAXIMUM MTU IN WINDOWS:
===============================================

netsh interface ipv4 show interface  <----  THIS GETS THE INDEX # FOR THE INTERFACE

Idx     Met         MTU          State                Name
---  ----------  ----------  ------------  ---------------------------
  1          50  4294967295  connected     Loopback Pseudo-Interface 1
          10        1500  connected     Ethernet

Now we're going to issue a ping command with a "-f" parameter to tell it not to allow fragmentation
and a "-l xxxx" command to tell if how large of a packet to send.  This allows us to find the largest
packet that we can get through without fragmentation.

ping server.contoso.com -l -f 1472  <---- THIS IS 1500 MINUS 28, THERE IS ALWAYS 28 BYTES OF "OVERHEAD"

Packet needs to be fragmented but DF set.  <---- MTU STILL TOO LARGE
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 server.contoso.com -l -f 1400  <---- KEEP TRYING LOWER NUMBERS UNTIL SUCCESS

Packet needs to be fragmented but DF set.  <---- MTU STILL TOO LARGE
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 server.contoso.com -l -f 1350  <---- KEEP TRYING LOWER NUMBERS UNTIL SUCCESS

Pinging X.X.X.X with 1350 bytes of data:
Reply from X.X.X.X: bytes=1350 time=1ms TTL=255  <---- SUCCESS! NOW WE NEED TO TRY A MTU IN BETWEEN THE LAST FAILED
Reply from X.X.X.X: bytes=1350 time=1ms TTL=255
Reply from X.X.X.X: bytes=1350 time=1ms TTL=255


ping server.contoso.com -l -f 1372  <---- KEEP NARROWING IT DOWN UNTIL SUCCESSFUL PING, IN OUR CASE 1372

Pinging X.X.X.X with 1372 bytes of data:
Reply from X.X.X.X: bytes=1372 time=1ms TTL=255
Reply from X.X.X.X: bytes=1372 time=1ms TTL=255
Reply from X.X.X.X: bytes=1372 time=1ms TTL=255


ping server.contoso.com -l -f 1373  <----  AS A FINAL TEST, INCREMENT THE SIZE BY 1 AND IT SHOULD FAIL
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.

Now that we know the exact size, we can set the MTU on the NIC using the index # that we grabbed earlier

netsh inteface ipv4 set interface "4" mtu=1372 store=persistent
 

The Sappy Part

As an IT guy, I live to conquer these problems and I know my reward is the silence of the content.  After doing this type of work for over 25 years, one bit of advice that I can offer to anyone getting started in this field:  Don't expect the users to bust down your door to thank you for a functioning PC/server/domain/network.  Your reward is the lack of a visit from the users.  Learn to appreciate that silence. By now, I am finally eating dinner and my son walks in and, gets on his PC an connects to his game, and announces to his friends that he can finally connect to the servers now.  As I pass by, I can't accept the "silence of the content" this time, my son needs to appreciate the amount of time and effort that went into fixing his game. Me:  "Did you notice anything?" My son:  (peeling off his headset)" Thank you Dad!"

 

Miscellaneous

One last note:  I had a different MTU issue over a year ago that was reported by a user who could not get to "some sites".  Their web browser would connect to a site but would just quit at a blank browser screen after partially downloading site content.  That incident turned out to be due to a piece of network equipment being configured not to allow fragmentation.  The same filter in the above network capture was critical in pinpointing that issue.

The Rescued Animal Part

MTU2Smoky.jpg

 

Watching this from the distance is our ferocious house cat Smokey, who doesn't care a bit about any MTU size issues.  We are big animal fans in our household so I feel a need to point them out whenever I can.  Smokey was rescued as a kitten from under the hood of a car where he had ridden over 15 miles.  How he survived that trip, I have no idea.  There are lots of animals at your local humane society like Smokey, go give them a good home.
9 Comments
Copper Contributor

Nice info and use case for Microsoft Message Analyzer. But MMA is going to be retired and removed from download on November 25 2019 :sad::suprised:

https://docs.microsoft.com/en-us/message-analyzer/microsoft-message-analyzer-operating-guide

 

Important
Microsoft Message Analyzer (MMA) is being retired and its download packages removed from microsoft.com sites on November 25 2019. There is currently no Microsoft replacement for Microsoft Message Analyzer in development at this time. If you already have Microsoft Message Analyzer installed, you may continue to use it, along with the OPN parsers you have already downloaded. Parsing ETW traces will also continue to work as before. After November 25 2019 when MMA is launched, it will attempt to connect to the back-end Feed service to check News and Assets updates and an error message will appear. To dismiss this errror message, see Dismiss Error Message.

 

Brass Contributor
In concerns about MMA, wow that's seems like MS is throwing away (no updates etc) a really good tool, I constantly tell people to use it but as you know most people just use wireshark if they are doing normal network analysis and for that it works just fine. MMA does so much more then just network stuff but its overkill for most techs, maybe they're working on something better, here's hoping.
Steel Contributor

Always hated MMA. I'm sure you can do much more with MMA than with Wireshark. But Wireshark just works and it's self-explanatory, as opposed to MMA which is a pain to learn and understand properly and too verbose.

Brass Contributor
Yes it wasn't the easiest tool to use but I still think its our loss on this one.
Iron Contributor

thanks. however when i find out the correct mtu size and i set it, i have to set even lower again.

 

what i mean is when i use the command and find out 1400 mtu is the best size and i set on my router, after applied i went to do ping www.yahoo.com -f -l 1400, it will return Packet needs to be fragmented but DF set.

 

then i find out 1300 mtu is the correct size and i set on my router, after applied i went to do ping www.yahoo.com -f -l 1300, it will return Packet needs to be fragmented but DF set.

 

it is like never ending lower and lower. i reverting back to original 1500 mtu

 

 

 

Copper Contributor

@jrng perhaps you forgot to subtract packet encapsulation overhead of 28B, as mentioned in the article?

THERE IS ALWAYS 28 BYTES OF "OVERHEAD"

 therefore 1400-28=1372 is your value for "ping test" because the overhead of 28B is added on your packet as far as I understand

Copper Contributor

I have run in to the MTU issue numerous times over the years. What I like to do is enable icmp black hole detection (EnablePMTUBHDetect in the reg, off by default). That, combined with Path MTU Discovery (on by default), will cause your system to automatically try smaller packets if it detects full size packets are getting dropped. You will get a delay of a couple of seconds and then the connection works.

 

The equivalent on Linux is tcp_mtu_probing.

Copper Contributor

Here is Path MTU Discovery together with ICMP Black Hole detection in action.

WesEv_0-1635880134615.png

And here is the failure.

 

WesEv_1-1635880219441.png

 

Brass Contributor

Microsoft Message Analyzer is on Softpedia

 

Download Microsoft Message Analyzer 1.4 Build 4.0.8112.0 (softpedia.com)

 

ETL files can also be opened with WPA

 

Getting Started Windows Performance Analyzer | Microsoft Docs

 

You can download the deployment kit and just install only the windows performance analyzer

Version history
Last update:
‎Nov 21 2019 07:06 PM
Updated by: