Mac OS X 10.2: How to Set the MTU Value During Startup

Use the procedure below to create a startup item script that sets the maximum transmission unit (MTU) value for your network interface(s). This may be required when using certain Internet service providers.

Note: This document applies to Mac OS X 10.2 through 10.2.8.
Important:
Follow these steps to create a script that sets the MTU each time the computer restarts:

1. Open Terminal (/Applications/Utilities/).
2. Type: cd /Library
3. Press Return.
4. Type: mkdir StartupItems
5. Press Return. (If you encounter an error, continue to step 6.)
6. Type: cd StartupItems
7. Press Return.
8. Type: mkdir MTU
9. Press Return.
10. Type: cd MTU
11. Press Return.
12. Type: pico MTU
13. Press Return.
14. In the pico editor, paste in the following text.

Begin copying below this line.
#!/bin/sh

. /etc/rc.common

##
# Configure a network interface MTU setting
##
#
# This script will set the MTU setting for the specified interface(s)
#
# The name of the interface (ex. en0) must be edited to match the interface
# to which the MTU setting should be applied
#
##

StartService ()
{
ConsoleMessage "Configuring MTU"

### uncomment lines and change the value following 'mtu' as appropriate

if [ "${MTU:=-NO-}" = "-YES-" ]; then

# /sbin/ifconfig en0 mtu 1490
# /sbin/ifconfig en1 mtu 1490

fi

}

StopService ()
{
return 0
}

RestartService ()
{
return 0
}

RunService "$1"


End copying above this line.

15. Uncomment the /sbin/ifconfig line(s) to set the MTU for a particular interface.

Note: Removing the number sign (#) from the beginning of a line uncomments it. Typically, en0 is the interface name for the Built-in Ethernet port and en1 is interface name for the AirPort Card. This is not always the case, though. To confirm that a network port is associated with a particular interface name, open the Network Utility (/Applications/Utilities/), and click the Info tab.

16. When you have finished customizing the file, save it (press Control-O), press Return, and exit pico (press Control-X).

17. Type: chmod 755 MTU

18. Press Return.

19. Type: pico StartupParameters.plist

20. Press Return.

21. In the pico editor paste in the following text.

Begin copying below this line.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Description</key>
	<string>Can set MTU</string>
	<key>OrderPreference</key>
	<string>None</string>
	<key>Provides</key>
	<array>
		<string>MTU</string>
	</array>
	<key>Requires</key>
	<array>
		<string>Network Configuration</string>
	</array>
</dict>
</plist>

End copying above this line.

22. When you have finished customizing the file, save it (Control-O), press Return, and exit pico (Control-X).
23. Type: chmod 755 StartupParameters.plist
24. Press Return.
25. Type: sudo pico /etc/hostconfig
26. When prompted, enter your password.
27. Press Return.
28. In the pico editor, add this line at the bottom:

MTU=-YES-

29. Save it (Control-O), press Return, and exit pico (Control-X).

When you restart the computer, MTU is set for the interface that you specified.

Notes

Published Date: Oct 7, 2016