What is needed here is a process that does this type of thing for us on startup, even before reaching the login screen. This is accomplished by creating a StartupItem, and putting it in /Library -> StartupItems. StartupItem is really a folder containing two parts: A shell script of the same name as the folder, and an XML file called StartupParameters.plist.
Create a folder called setDuplex in /Library -> StartupItems, and create a file inside with the same name. The file should contain the following text:
Make it executable by typing chmod a+x setDuplex. Note that you do not need a sudo command in the script, because it is already being run as root.
#!/bin/sh # forces 100baseTX and full-duplex . /etc/rc.common ifconfig en0 media 100basetX mediaopt full-duplex
Next, create another file called StartupParameters.plist, containing the following text:
Restart, then type ifconfig -a in the Terminal, and your en0 interface should no longer say autoselect, and should have the correct settings.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> <plist version="0.9"> <dict> <key>Description</key> <string>My Force-Duplex</string> <key>Messages</key> <dict> <key>start</key> <string>Forcing Full-Duplex</string> </dict> <key>OrderPreference</key> <string>Early</string> <key>Provides</key> <array> <string>Proper Duplexing</string> </array> </dict> </plist>
Forgive me if there are any errors, etc - this is my first shell script, and first XML file! I believe everything should be ok, though! It works well on my server.