8

Recently (I think after updating to 10.6.4) Mac OS X has insisted on changing my MTU to 1500, even though the router which my Mac connects to directly has an MTU of 1472. I've noticed that manually setting the MTU to 1472 drastically increases performance, presumably because it all but eliminates packet fragmentation, but Mac OS X periodically changes the MTU back to 1500.

Does anyone know why or how to stop it?

Chealion
  • 25,408
  • 8
  • 67
  • 75
Ritwik Bose
  • 868
  • 5
  • 13
  • 30

5 Answers5

6

You can turn off the automatic discovery of MTU size on Mac OS X with this :

  • Session only :

sudo sysctl -w net.inet.tcp.path_mtu_discovery=0

  • Permanent :

    • Edit the file /etc/sysctl.conf, for example :

      sudo nano /etc/sysctl.conf

    • Then add the following line :

      net.inet.tcp.path_mtu_discovery=0

    • Finally reboot

This will prevent Mac OS X from automatically setting the MTU size, but you'll still need to setup your size manually.

Studer
  • 3,766
  • 19
  • 26
3

Unfortunately, you did not mention how you set the MTU. Did you already try this?

Mac OS X 10.4 or later: How to change the MTU for troubleshooting purposes

It's the official way to set a non-standard MTU persistently.

knweiss
  • 1,706
  • 1
  • 13
  • 12
  • That is in fact what I did. I have not had this problem before 10.6.4, though I updated at the same time that I fiddled with my router, so perhaps I stopped broadcasting my MTU... – Ritwik Bose Jul 11 '10 at 12:00
3

A band-aid solution could be to run the following Terminal command (or run it via AppleScript) everytime you log in:

sudo networksetup -setMTU en1 1472

This won't fix the underlying issue of the MTU reseting. I suggest reporting the bug to Apple via BugReporter.

Chealion
  • 25,408
  • 8
  • 67
  • 75
2

I set the MTU using the ifconfig command.

ifconfig en0 mtu=1492 

You have to use your own adapter id, mine is en0.

This is the only way it would stay at the set rate. I tried using the "official" method and it always immediately reverted.

I also used the command above to stop using automatic:

net.inet.tcp.path_mtu_discovery=0

I tried it both ways and I had to go to manual in order for this to work.

slhck
  • 223,558
  • 70
  • 607
  • 592
Paul Krupa
  • 21
  • 1
1

I have been doing some network testing here on osx 10.6.7 and discovered that the mtu was always falling to 1500. The Solution here was to turn ON the auto discovery in osx and make sure the router is set to the desired mtu and not auto.

tleeuser
  • 11
  • 1