Hard-Code Speed and Duplex Settings for NICs
PROBLEM: Permanently forcing the link speed and duplex settings of a network card in SUSE.
SOLUTION: For a system that will be network attached long term it is best practice to hard code the link speed and duplex setings on the nic(s) in the system to match the switch port settings. This prevents allignment errors, runts, FCS and other errors from occuring on the switch when the system autonegotiates network settings.
To turn off autosensing and permanently force the link speed and duplex of a network card in SUSE:
Edit the file /etc/sysconfig/network/ifcfg-eth-id-<MAC Address of NIC>.
For systems with multiple NIC’s there will be a file for each card with it’s MAC address integrated in to the file name. Each has to be edited for the settings to be permanent, per card.
Open the file(s) for editing and add the following line to the bottom of the file.
POST_UP_SCRIPT=settings-id-<MAC Addresses of the NIC>
Save the file.
Next, create a small script in the /etc/sysconfig/network/scripts directory:
Call it whatever you like and save it with a .sh extension. It will be executed whenever the system is started.
For example to force 100/FULL add the following to the script.
#!/bin/bash ethtool –s eth0 duplex full speed 100 autoneg off #end
One script with multiple lines is adequate to activate the settings for each card. eth0 is for the first NIC, eth1 would be for the second, etc..
Remember everything is case sensitive. Reboot the server, and have the switch port checked. it should be free of autonegotiation errors.