Forcing Full Duplex on CentOS/Redhat

From Peter Pap's Technowiki
Jump to: navigation, search
Forcing Full Duplex on CentOS/RedHat Linux

As with Solaris, if the network switch a CentOS/RedHat server is attached to is set to force 100mb full-duplex, the default behaviour of the server will be to autonegotiate to 100mb half-duplex. To change this, you can alter the running system with the 'ethtool' command. The 'ethtool' command can be used in the following ways:

1. To determine the current status of network interface 'eth0'

  [root@centos ~]# ethtool eth0
  Settings for eth0:
       Supported ports: [ MII ]
       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: 100Mb/s
       Duplex: Half
       Port: Twisted Pair
       PHYAD: 1
       Transceiver: internal
       Auto-negotiation: on
       Supports Wake-on: g
       Wake-on: d
       Current message level: 0x000000ff (255)
       Link detected: yes

2. To force 100mb full duplex and turn off autonegotiation on network interface 'eth0'

  [root@centos ~]# ethtool -s eth0 speed 100 duplex full autoneg off

The output of the 'ethtool eth0' should now look like this:

  [root@centos ~]# ethtool eth0
  Settings for eth0:
       Supported ports: [ MII ]
       Supported link modes:   10baseT/Half 10baseT/Full
                               100baseT/Half 100baseT/Full
                               1000baseT/Half 1000baseT/Full
       Supports auto-negotiation: Yes
       Advertised link modes:  Not reported
       Advertised auto-negotiation: No
       Speed: 100Mb/s
       Duplex: Full
       Port: Twisted Pair
       PHYAD: 1
       Transceiver: internal
       Auto-negotiation: off
       Supports Wake-on: g
       Wake-on: d
       Current message level: 0x000000ff (255)
       Link detected: yes

NOTE: This change will be lost on the next reboot.

To make the change permanent, you need to edit the config file for the network interface. These live in /etc/sysconfig/network-scripts. Each interface will have a file called 'ifcfg-ethX', ie. for 'eth0' the file would be 'ifcfg-eth0'. To make it so that when the machine is rebooted it comes up with the network interface at 100mb full-duplex, add the following line to this file:

  ETHTOOL_OPTS="speed 100 duplex full autoneg off"