Thursday, March 17, 2011

CentOS NIC Settings (Speed & Duplex)

We ran into an issue with the speed and duplex settings on one of our CentOS boxes during a recent upgrade of our infrastructure to HP ProCurve 8112zl switches.  Because I futz with this about once a year I figured I’d write it down so I could look up up next time… Smile

Step 1: Determine what NIC is in your CentOS box so you can see it’s capabilities.

#lspci | grep Ethernet

This should give you something like (excuse the wrap):

0a:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)

Step 2:  Check how the nic is currently set:

#ethtool eth0:

This should give you something like:

Settings for eth0::
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: Twisted Pair
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: g
        Wake-on: g
        Current message level: 0x000000ff (255)
        Link detected: yes

 

Step 3:  Force the speed to say, 100Full (just for grins):

Edit /etc/sysconfig/networking-scripts/ifcfg-eth0
Add the line:

ETHTOOL_OPTS="speed 100 duplex full autoneg off"

The bounce the network service:

#service network restart

That’s it.  Also be sure to check the config on the switch so it matches.  And remember… always be consistent on both sides of the setup. If the server is auto, set the switch to auto. If the server is 100Full, force the switch port to 100Full.

4 comments:

Anonymous said...

I am running CentOS 6.2 and this is all I get when I run 'ethtool eth0'


[root@dev179 bin]# ethtool eth0:
Settings for eth0::
Link detected: yes

Since this was a Xen virtual machine, the ethtool will NOT work. You must install the virtual tools to make it work.

olkid said...

set the autoneg off first as the option entries are order dependent. Ex)ETHTOOL_OPTS="autoneg off speed 100 duplex full"

olkid said...

Update: the above post was according to CentOS documentation. Found it to not be accurate on various card/driver pairs.

Key information for my situation: auto-negotiation is a requirement for using 1000BASE-T(wikipedia.org)

olindamacchi said...

Play Casino Slots Online - JTHub
Play casino slots 인천광역 출장샵 online - all you need to do is sign up 이천 출장마사지 to our site and 전라남도 출장안마 bet with your username. · Enter the bonus 양주 출장마사지 code: No Deposit Required. · 광양 출장마사지 Once you've completed