Manually Managing MTU Size in Mac OS X

MTU stands for “Maximum Transmission Unit.” Whenever you transmit and receive data in Mac OS X, the data is broken up into smaller pieces (called packets) and then reassembled on the other end of the connection. Think of it like a jigsaw puzzle: You go to the store to find a puzzle, and they come in different sizes, ranging from 20-10,000 pieces. Everyone knows that the more pieces you need to put the picture back together, the longer it takes. The same thing is true with computer data.

Suppose, you want to download a song from the iTunes Music Store. Or you’ve come across a freshly released movie that you planned to watch this Friday night. Or you want to save on your computer an audio or video guide containing advice to help with personal statement writing. Naturally, you want to get all of these things as quickly as possible. And as you increase the amount of data in a packet, you decrease the number of packets iTunes needs to transmit, which reduces the time it takes to receive the file. That’s great until you tell the computer to transmit packets larger than your ISP can handle. If your ISP can handle 1500 bytes, but you specify 1800 bytes, you might get the 1500 bytes, but then your computer has to tell iTunes, “Hey, I didn’t get those other 300 bytes. Please resend them.” iTunes sends the data, but it has to do so in a new packet, which means it takes longer to get all the data to your computer.

Determining the MTU for your current network is not difficult, but it is a matter of trial and error. There are some caveats. First, each network has its own MTU, so your home network may be different from work and from the local coffee shop. Thus, if you set a custom MTU and then change networks, you probably need to change the MTU to match the new network. Second, the standard MTU size for Ethernet/AirPort connections is 1500. For Ethernet DSL (PPPoE), it is 1492. Third, it is unlikely your MTU size is greater than 1500 or lower than 1400, but feel free to experiment with different values.

When you want to be able to manually set your MTU size, you must first open System Preferences, then the Network system preference. When that preference opens, select the network interface you use to connect to the Internet (likely Ethernet or Wi-Fi), and then press the “Advanced” button in the lower right corner of the window. When the Advanced window appears, you can then click on the “Hardware” tab (or the “Ethernet” tab if you’re running Snow Leopard or earlier). This is the section where you can edit the MTU value. Mac OS X can already determine your network’s proper MTU, so only adjust this setting if you are experiencing persistent slowdowns, especially when attempting to download files. Read on to determine your ideal MTU value.

Hardware mac

Mac OS X can already determine your network’s proper MTU, so only adjust this setting if you are experiencing persistent slowdowns, especially when attempting to download files.

To determine your network’s MTU:

  1. Open Terminal (in your Utilities folder). You are going to “ping” another server. This means you are going to send another server a little bit of data and ask it to respond to you. It is the equivalent of tapping someone on the shoulder, except in this metaphor, you get no response when you tap someone too hard (or send a packet that is too large).
  2. Type this command and press Return:

ping -c 2 -D -s 1472

  • The -c switch tells ping how many packets to send. I chose to specify two packets. You could choose 1 or 100 or even eliminate this switch to ping endlessly (not recommended, but if you do this and need to stop the ping, hold down the Control key and press the letter “C”).
  • The -D switch tells ping not to fragment the packet (meaning that if the size of the packet is too large, don’t send it at all).
  • The -s switch allows you to specify the size of the packet in bytes. That is what the 1472 next to the -s switch. This is important: Any ping that you do via the above method adds 28 bytes of overhead to the ping. This means you must add 28 bytes to the size of your packet to get the packet’s true size. In the above example, we pinged with 1472 bytes. Add 28 to that number, and you get 1500. If 1472 is the largest packet you can successfully send, then your MTU value is 1500. If the largest packet you could send were 1464, then your packet size would be 1492.
  1. When you run the above command, ping can give you two different replies:

ping: sendto: Message too long

If you get a response that the message is too long, that means the packet size is too large and must be reduced.

1480 bytes from icmp_seq=0 ttl=46 time=185.42 ms

  • The above line is the other reply you may receive from ping, and it indicates a successful ping. Your response may look slightly different: the IP address may change, the time it takes to ping may change, etc. The point is that this line looks very different from the “message too long” line. If you ran the exact command from above, you should see either two successful pings or two failed pings, since the -c switch was set to
  • In fact, at the end of the ping process, you may see a statistics line that shows either 0% packet loss or 100% packet loss (0% means every packet went through, 100% means none of the packets did).
  1. Your goal is to continually increase the packet size in the ping request until you receive a “message too long” reply (or, if you are only receiving those messages, lower it until you can successfully ping a server). Add 28 to the largest packet size you can successfully ping, and this is your MTU. To manually set your MTU in the “Hardware” tab of the Advanced window in the Network system preference, change the “Configure” pop-up menu form “Automatically” to “Manually.” Then, switch the “MTU” pop-up menu from “Standard” to “Custom.” Finally, enter your MTU in the box that appears and click OK to save your settings.

Did this guide work for you? How important do you feel it is to edit the MTU value? How has it affected your network performance? Let others know in the comments.