Set MTU Size from Command Line - Mac OS X

Jan 15, 2013 - by Dan Jones

MTU stands for Maximum Transmission Unit, and a larger MTU size generally increases efficiency of a network connection because each packet carries more data, but sometimes the default MTU sizes (often 1500) will cause issues with some networks and needs adjusting. Changing the MTU size has been a solution to some dropping wi-fi connections in OS X, particularly when the standard protocol of deleting the wireless pref files hasn’t worked to resolve stubborn issues.

If you’re in a situation where you need to change the transmission unit size, you can do so easily through the command line by way of the ever-useful networksetup utility. It’s probably important to note that most users will never need to adjust this setting, making this a more advanced tip.

To see the current MTU size, use the following networksetup flag:

networksetup -getMTU

Unless it has been changed, the default MTU size in OS X is 1500 and will be reported back like so:

Active MTU: 1500 (Current Setting: 1500)

To change that and set a new MTU size, use the -setMTU flag, choose the interface, and provide a new size, like so:

networksetup -setMTU en0 1453

en0 in this case is the wi-fi interface of a MacBook Air without an ethernet port, and 1453 is the MTU setting chosen for the example because it’s the magic number that resolved a persistent wireless dropping problem with some Macs.

You can verify the change took place by using the -getMTU flag again to verify the number. For the change to actually take effect, you will probably want to cycle the wi-fi connection off and on which can also be done through networksetup, though that isn’t always necessary.


via - OSXDaily