Hard-Code Speed and Duplex Settings for NICs

Share
Share

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.

Share
(Visited 1 times, 1 visits today)

Comments

  • Anonymous says:

    To my humble opinion, there is an easier way to hard-code the settings for an interface:
    in the file: /etc/sysconfig/network/ifcfg-eth-id-“MAC address”
    put a variable ETHTOOL_OPTIONS and assign the necessary settings
    e.g.
    ETHTOOL_OPTIONS=’autoneg off speed 100 duplex full’

    Like this there is no hassle with extra scripts.

    Greetings
    Ph. Vervoort

  • Anonymous says:

    Is there a white paper or something to reference this best practice? I thought that the only “standard” was autoneg. There was never a specific “how” for vendors to implement hardcoded speed/duplex, unlike autoneg, which was clearly defined for vendors.

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    11,845 views