Important:
- This document discusses an advanced procedure, intended primarily for institutional networks on which certain third-party hardware precludes automatic negotiation of a full duplex connection. If you are not familiar with command line interface and manual configuration in general, you should seek assistance. If you do not follow these steps precisely, the script may not work, which could prevent the computer from starting up normally.
- AppleCare does not offer any type of free technical support on setting up or creating Startup Items. Contract based support for setting up and creating Startup Items, and creating shell scripts is only offered by Apple Professional Services. For more information on Apple Professions Services see ( http://www.apple.com/services/ ).
Note: You may not be able to configure the available options on some Ethernet network interfaces and network connections. Use the ifconfig command to test a particular option before using it in the script. You cannot set the speed and duplex settings for AirPort Cards.
Follow these steps to create a script that is executed during startup, setting the speed and duplex settings:
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 SpeedDuplex
9. Press Return.
10. Type:
cd SpeedDuplex
11. Press Return.
12. Type:
pico SpeedDuplex
13. Press Return.
14. In the pico editor, paste in the following text.
Begin copying below this line.
#!/bin/sh
##
# Configure network interface speed and duplex settings
#
# Note: speed and duplex settings are not supported on AirPort cards
#
##
. /etc/rc.common
StartService ()
{
ConsoleMessage "Configuring Speed and Duplex"
##
# Speed and Duplex
##
if [ "${SPEEDDUPLEX:=-NO-}" = "-YES-" ]; then
# /sbin/ifconfig en0 media 10baseT/UTP mediaopt full-duplex
# /sbin/ifconfig en0 media 100baseTX mediaopt full-duplex
# /sbin/ifconfig en0 media 1000baseTX mediaopt full-duplex
#
# /sbin/ifconfig en0 media 10baseT/UTP mediaopt half-duplex
# /sbin/ifconfig en0 media 100baseTX mediaopt half-duplex
# /sbin/ifconfig en0 media 1000baseTX mediaopt half-duplex
fi
}
StopService ()
{
return 0
}
RestartService ()
{
return 0
}
RunService "$1"
End copying above this line.
15. If you want to set the speed and duplex of an interface, uncomment one of the six speed lines (such as "/sbin/ifconfig en0 media 100baseTX mediaopt full-duplex") that you want for that interface. If you leave all six lines commented, then the interface remains in auto-select mode.
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. To confirm that a network port is associated with a particular interface name, note its Ethernet Address on the TCP/IP tab of the Network preference pane and compare that to the output of the ifconfig command when entered in the Terminal.
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 SpeedDuplex
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 Speed and Duplex</string>
<key>OrderPreference</key>
<string>None</string>
<key>Provides</key>
<array>
<string>SpeedDuplex</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 account password.
27. Press Return.
28. In the pico editor, add this line at the bottom:
SPEEDDUPLEX=-YES-
29. Save it (Control-O), press Return, and exit pico (Control-X).
When you restart the computer, speed and duplex settings are set for the interface that you specified.
Notes
1. The speed and duplex setting will be reset after changing a Location, waking the computer from sleep, or changing the state of the network interface. To use the script again without having to restart, enter the following command:
sudo SystemStarter start SpeedDuplex
2. If you experience any issues or do not want to set speed and duplex during startup, you can turn off the script by changing the SPEEDDUPLEX line in /etc/hostconfig to:
SPEEDDUPLEX =-NO-