Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A script to determine Maximum Transmission Unit Network
Though OS X should, under normal circumstances, just automagically figure all this stuff out on its own, certain brain-dead networks are messed up to the point that standard settings won't work reliably and OS won't be able to auto-correct.

In particular, some (not me, thankfully) will have a problem with their Maximum Transmission Unit (MTU) set too high. There are some older hints discussing this problem, but none really discuss how to figure out if you do or not.

This script will do the trick. If it says that your MTU is 1500 or more, you can forget all about MTUs. If it says it's something smaller, and you've been having network problems, you've probably found at least one of the mysterious sources of your troubles. If it says it's something smaller, and your network is behaving properly, just forget you ever ran the script.

[robg adds: Save the script using your favorite text editor, and then remember to make it executable (chmod a+x script_name) before running it. You should also edit line 13 (PingHost="ns.fastq.com") and replace the hostname with a host of your choosing -- your local nameserver is suggested in the script's comments. I tested it, and it seems to work as described.]
    •    
  • Currently 3.40 / 5
  You rated: 5 / 5 (5 votes cast)
 
[14,231 views]  

A script to determine Maximum Transmission Unit | 16 comments | Create New Account
Click here to return to the 'A script to determine Maximum Transmission Unit' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to determine Maximum Transmission Unit
Authored by: macubergeek on Feb 07, '06 08:56:37AM

The 802.3 standard mtu is 1514 byes. For 802.11, the IEEE lists it at 1518 bytes.
However 1500 bytes is the customary limit set on network devices.

It's been my experience that 1500 bytes is wildly optimistic on most commercial networks. So if you are running this on an enterprise network (like at work) consider 1400 bytes to be typical and expected. Now 1500 bytes on your home DSL or cable net connection might be typical though.



[ Reply to This | # ]
A script to determine Maximum Transmission Unit
Authored by: murali1080 on Feb 07, '06 11:06:24AM

Wouldn't command line tool, ifconfig, do the same? Why do we need a new script?



[ Reply to This | # ]
A script to determine Maximum Transmission Unit
Authored by: kaih on Feb 07, '06 01:45:44PM

This script doesn't set your MTU, rather it determines what the maximum ethernet frame size is that you can use, without fragmentation.
Setting the MTU is then left up to you.

Now, it's worth noting that setting the MTU to the biggest value it can be isn't always the best setting.
For instance, on an ADSL connection, all the heavy lifting is done by an ATM network and ATM cells are 53 bytes, so if you're on ADSL, you might get better performance by setting your MTU to the biggest value it can be that is a multiple of 53 - which, if you can use 1500 byte frames, make your MTU 1484 bytes and then you're using a whole multiple of ATM cells on the backbone network for each ethernet frame you send.

---
k:.



[ Reply to This | # ]
A script to determine Maximum Transmission Unit
Authored by: codewhore on Feb 14, '06 05:48:41AM
Short answer, yes.

Idun:~ timo$ ifconfig
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
...

And to modify MTU on interface en0 to size of 1436

Idun:~ timo$ ifconfig en0 MTU 1436


[ Reply to This | # ]
A script to determine Maximum Transmission Unit
Authored by: gizmo on Feb 07, '06 11:57:57AM

Can't you also set the MTU size under the Network settings? At least for your Ethernet Connection? Under Network in System Prefrences click on the Ethernet Connection followed by the Ethernet tab. If you set Configure to Manually then you have options to change the Speed, Duplex and MTU.



[ Reply to This | # ]
A script to determine Maximum Transmission Unit
Authored by: osxpounder on Feb 08, '06 11:35:17PM

My home Mac connects via a wireless adapter, so I don't get that configuration panel you described -- I don't see any way to adjust the MTU size for my Mac using "Airport" [actually, I think it's a Belkin wireless card].

Since I have a slow ADSL connection, I kinda wanted to try changing my MTU to 1484 [this script reports "at least 1491" as my current MTU] to see if that would bring any noticeable speed increase.

---
--
osxpounder



[ Reply to This | # ]
A script to determine Maximum Transmission Unit
Authored by: RickoKid on Jun 08, '08 08:55:51AM
For a script to set the MTU see this hint, or the original script on my blog.

It seems however, that the Airport interface has acquired a new Ethernet tab in the Advanced settings in Leopard (certainly on my MacBook running 10.5.3), and you can change the MTU in there for airport interfaces.

---
Visit my technology (and Apple in particular) blog at http://tumbleseed.torrfamily.org/

[ Reply to This | # ]

A script to determine Maximum Transmission Unit
Authored by: b00le on Feb 08, '06 02:04:37AM

I wanted to use this to see if it would solve a problem I was having at work, but the instructions are incomplete - some of us would rather drill our own teeth than use Terminal (life is too short) and I don't know how to point that chmod command at my file. My real question is: there's a whole scripting facility built into OS X, with a script editor and all - geek value zero. Is there a way to test the MTU using that? And why not? The script as given is incompatible with Script Editor.



[ Reply to This | # ]
AppleScript not so easy...
Authored by: gabester on Feb 08, '06 06:45:02AM

Yes, this likely could be rewritten as an AppleScript, but for most people, AppleScript is actually a much more difficult language to learn, implement and use than shell scripting or perl - mostly because on the face of it simple commands like 'tell Application "Finder" to open the selected file' seem to work, but once the script becomes more complex than that elements of error checking and even syntax parsing become quite obtuse.

Learn to use the command line - it is your friend, and skills there apply to many more computing platforms than OS X. Spending time learning AppleScript is probably not worth the investment for most people, given its esoteric nature. g=



[ Reply to This | # ]
AppleScript not so easy...
Authored by: b00le on Feb 08, '06 07:30:56AM

Well that's interesting, but I've only ever once needed Terminal before (and I've been using OS X professionally from the start) and at least that time the ubergeek waas condescending enough to provide complete instructions. I found out by myself that I can drag a file into terminal to get the path, and did the chmod o+x thing - so nice and intuitive: nothing at all seemed to happen - and I still don't know how to 'run' the script I have. I know this site is for 'hints' but what does it take to actually tell us how to do something?



[ Reply to This | # ]
AppleScript not so easy...
Authored by: mistersquid on Feb 08, '06 09:55:30AM

Download the script and open a Terminal window. Change the permissions on the script so that the script is executable. It seems you know how to get this far.

The next step is to type at the command line

./NAMEOFSCRIPT
where "NAMEOFSCRIPT" is the name of the script you made executable. The "./" is command line-ese for "run what comes next."

Gabester is right, however. If you really want control over your Mac the most direct way is the command line. Because of this, many advanced techniques will specify command line interaction. If you've been around Macosxhints for any length of time, you almost certainly know this to be true.

That said, yes, the command line is scary for most GUI-only users. There is a learning curve to the command line but--and this is an important but--it is very simple to get started on that learning curve. You can learn a lot in twenty minutes that will make your Mac OS life much easier (and richer and complex) by dipping a toe into the "mysterious" waters of the CLI (command line interface).

The best way is to get experience in a UNIX shop. But since you are a professional and, as you say, "life is too short," there is a great batch of OS X command line tutorials at Macdevcenter.com. The first tutorial is a great place to start since it is designed to help beginning CLI users with a "step by step [of] how to get comfortable with the Terminal".

Happy travels.



[ Reply to This | # ]
AppleScript not so easy...
Authored by: b00le on Feb 09, '06 02:10:22AM
Thanks, but I still can't make it work - here's the session (I tried it twice because I couldn't figure out how many slashes were needed)
Welcome to Darwin! grant-thompsons-power-mac-g5:~ grant$ chmod o+x /Users/grant/Desktop/scriptmtu
grant-thompsons-power-mac-g5:~ grant$ .//Users/grant/Desktop/scriptmtu
-bash: .//Users/grant/Desktop/scriptmtu: No such file or directory
grant-thompsons-power-mac-g5:~ grant$ ./Users/grant/Desktop/scriptmtu
-bash: ./Users/grant/Desktop/scriptmtu: No such file or directory
I might have a look at those tutorials if I ever have time but frankly, I want to use my computer, not futz with its vitals. I started out in the era of punched cards and men in white coats and thought back then there must be a better way. I see neither charm nor virtue in the CLI. As I said I've only used it once before, following a hint from this site. At least it worked that time (though it didn't help...)

Maybe one of you wizards can tell me why Msoft Windows Service Pack 1 breaks OS X access to servers - in exactly the same way it was broken when 10.4 first came out. I'm running 10.4.4.
mount_smbfs: error from NetrShareEnum call: exception = 382312522
mount_smbfs: tree connect phase failed: syserr = Permission denied


[ Reply to This | # ]
AppleScript not so easy...
Authored by: el bid on Feb 10, '06 03:07:53AM

>Maybe one of you wizards can tell me why Msoft Windows
>Service Pack 1 breaks OS X access to servers - in exactly
>the same way it was broken when 10.4 first came out.
>I'm running 10.4.4.

The usual joke here is that Windows is expecting encrypted passwords and OS X is offering plain passwords, or the other way round. There's a hint about this at http://www.macosxhints.com/article.php?story=20050506120948120

As to the "scriptmtu" issue (actually mine downloaded under a different name -- you might need to check that, and perhaps "echo <filename>" to confirm that it looks like a script and isn't some junk), the easiest thing is just to change into the directory where the script is (cd <FullPathToDirectory> -- and, as you've discovered, you can drag the directory from the Finder to fill out that path) and then type "chmod a+x" and then <space> and then your dot-slash-filename. A handy tip to make sure you're spelling the filename right is to put in the first three or four letters and then hit <Tab>.


---
el bid



[ Reply to This | # ]
AppleScript not so easy...
Authored by: el bid on Feb 10, '06 02:08:14AM

> The "./" is command line-ese for "run what comes next."

Not quite. It's just the path name locating the file you want to run -- "in the current directory". Folks coming to UNIX from DOS trip up on this because DOS automatically assumes "current directory" as the location, although in fact that "." means the same thing in DOS (but they get their slashes the wrong way round...). UNIX needs to know exactly where the executable is, so you need this abbreviation for the whole path.

BTW I wholeheartedly agree that the command line is your friend. C'mon, guys, we've all grown up now and we're running UNIX, the greatest operating system the world has ever seen... :-) Applescript belongs to the thin proprietary veneer on the top, and isn't even anything to do with the much thicker mid-layer NeXTStep stuff that does most of the non-UNIX work around here.

---
el bid



[ Reply to This | # ]
A script to determine Maximum Transmission Unit
Authored by: codeProle on Feb 08, '06 11:10:20AM

You can diddle file permissions from the Get Info dialog. Right-click (or CTRL-click) the object and select Get Info from the resulting menu.

Once the Get info dialog is display find the Ownership & Permissions section towards the bottom. Expand it to reveal a graphic interface to the permission settings.

---
--
15" G4 TiBook 867MHz 768 MB 40 GB



[ Reply to This | # ]
A script to determine Maximum Transmission Unit
Authored by: RickoKid on Jun 08, '08 10:51:21AM
I've written an AppleScript to set the MTU, and it includes parts of this script to lookup the maximum MTU ... you can get it from my blog: http://www.torrfamily.org/tumbleseed/products/set-mtu/

---
Visit my technology (and Apple in particular) blog at http://tumbleseed.torrfamily.org/

[ Reply to This | # ]